44 #ifndef ROL_RISKVECTOR_HPP 45 #define ROL_RISKVECTOR_HPP 49 #include "Teuchos_ParameterList.hpp" 56 Teuchos::RCP<std::vector<Real> >
stat_;
58 Teuchos::RCP<Vector<Real> >
vec_;
75 std::vector<Real> lower, upper;
76 bool activated(
false);
78 RiskMeasureInfo<Real>(parlist,name,nStat,lower,upper,activated);
83 stat_ = Teuchos::rcp(
new std::vector<Real>(
nStat_,stat));
89 const bool augmented =
false )
93 stat_ = Teuchos::rcp(
new std::vector<Real>(
nStat_,0));
99 const std::vector<Real> &stat,
100 const bool augmented =
true )
104 stat_ = Teuchos::rcp(
new std::vector<Real>(stat));
150 return sqrt(
dot(*
this) );
153 Teuchos::RCP<Vector<Real> >
clone(
void)
const {
154 std::vector<Real> stat(
nStat_,static_cast<Real>(0));
162 std::vector<Real> stat(
nStat_,static_cast<Real>(0));
176 Teuchos::RCP<Vector<Real> >
basis(
const int i )
const {
177 Teuchos::RCP<Vector<Real> > e1;
178 std::vector<Real> e2(
nStat_,static_cast<Real>(0));
183 else if (i >= n1 && i < n1+n2) {
184 e1 =
vec_->clone(); e1->zero();
185 e2[i-n1] =
static_cast<Real
>(1);
188 TEUCHOS_TEST_FOR_EXCEPTION(
true,std::invalid_argument,
189 ">>> ERROR (ROL::RiskVector::Basis): index is out of bounds.");
194 void applyUnary(
const Elementwise::UnaryFunction<Real> &f ) {
209 Real
reduce(
const Elementwise::ReductionOp<Real> &r )
const {
210 Real result = r.initialValue();
211 r.reduce(
vec_->reduce(r),result);
219 int dim =
vec_->dimension();
237 Teuchos::RCP<const Vector<Real> >
getVector(
void)
const {
249 TEUCHOS_TEST_FOR_EXCEPTION((i < 0 || i > (
int)
nStat_-1),std::invalid_argument,
250 ">>> ERROR (ROL::RiskVector::getStatistic): index out-of-bounds.");
251 TEUCHOS_TEST_FOR_EXCEPTION(!
augmented_,std::invalid_argument,
252 ">>> ERROR (ROL::RiskVector::getStatistic): vector is not augmented.");
271 stat_->assign(stat.begin(),stat.end());
Real norm(void) const
Returns where .
void scale(const Real alpha)
Compute where .
int dimension(void) const
Return dimension of the vector space.
void axpy(const Real alpha, const Vector< Real > &x)
Compute where .
Defines the linear algebra or vector space interface.
void setStatistic(const std::vector< Real > &stat)
const Real getStatistic(const int i) const
Teuchos::RCP< const Vector< Real > > getVector(void) const
Teuchos::RCP< Vector< Real > > clone(void) const
Clone to make a new (uninitialized) vector.
void setVector(const Vector< Real > &vec)
void plus(const Vector< Real > &x)
Compute , where .
Teuchos::RCP< Vector< Real > > getVector(void)
Teuchos::RCP< RiskVector< Real > > dual_vec_
RiskVector(const Teuchos::RCP< Vector< Real > > &vec, const std::vector< Real > &stat, const bool augmented=true)
void setStatistic(const Real stat)
void applyBinary(const Elementwise::BinaryFunction< Real > &f, const Vector< Real > &x)
Real dot(const Vector< Real > &x) const
Compute where .
Real reduce(const Elementwise::ReductionOp< Real > &r) const
void applyUnary(const Elementwise::UnaryFunction< Real > &f)
RiskVector(Teuchos::ParameterList &parlist, const Teuchos::RCP< Vector< Real > > &vec, const Real stat=1)
Teuchos::RCP< Vector< Real > > dual_vec1_
Teuchos::RCP< std::vector< Real > > stat_
Teuchos::RCP< StdVector< Real > > stat_vec_
Teuchos::RCP< const StdVector< Real > > getStatistic(void) const
Teuchos::RCP< Vector< Real > > vec_
void getStatistic(std::vector< Real > &stat) const
RiskVector(const Teuchos::RCP< Vector< Real > > &vec, const bool augmented=false)
Teuchos::RCP< Vector< Real > > basis(const int i) const
Return i-th basis vector.
const Vector< Real > & dual(void) const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
Teuchos::RCP< StdVector< Real > > getStatistic(void)