44 #ifndef ROL_CPLXSTDVECTOR_H 45 #define ROL_CPLXSTDVECTOR_H 62 template<
class Real,
template<
class>
class complex>
65 typedef std::vector<complex<Real> >
vector;
67 typedef typename vector::size_type
uint;
75 CplxStdVector(
const Teuchos::RCP<vector> &std_vec) : std_vec_(std_vec) {}
77 void set(
const V &x ) {
80 std::copy(xval.begin(),xval.end(),std_vec_->begin());
88 (*std_vec_)[i] += xval[i];
92 void axpy(
const Real alpha,
const V &x ) {
97 (*std_vec_)[i] += alpha*xval[i];
104 (*std_vec_)[i] *= alpha;
108 complex<Real>
dot(
const V &x )
const {
112 complex<Real> val = 0;
114 val += (*std_vec_)[i]*std::conj(xval[i]);
121 val = std::sqrt(std::abs(
dot(*
this)));
125 return Teuchos::rcp(
new StdVector( Teuchos::rcp(
new std::vector<Element>(std_vec_->size())) ));
136 Teuchos::RCP<V>
basis(
const int i )
const {
137 Teuchos::RCP<CplxStdVector> e = Teuchos::rcp(
new CplxStdVector( Teuchos::rcp(
new vector(std_vec_->size(), 0.0)) ));
138 (*e->getVector())[i] = 1.0;
143 return static_cast<int>(std_vec_->size());
148 Teuchos::RCP<vector> x_rcp = Teuchos::rcp(
new vector(dimension,0.0) );
150 (*x_rcp)[i] = std::conj( (*std_vec_)[i] );
162 #endif // ROL_CPLXSTDVECTOR_H
Real norm() const
Returns where .
complex< Real > dot(const V &x) const
Compute where .
Defines the linear algebra or vector space interface.
void scale(const Real alpha)
Compute where .
Teuchos::RCP< vector > std_vec_
Teuchos::RCP< V > dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
CplxStdVector(const Teuchos::RCP< vector > &std_vec)
Teuchos::RCP< vector > getVector()
Provides the std::vector implementation of the ROL::Vector interface.
void axpy(const Real alpha, const V &x)
Compute where .
Teuchos::RCP< const vector > getVector() const
int dimension() const
Return dimension of the vector space.
std::vector< complex< Real > > vector
Teuchos::RCP< V > basis(const int i) const
Return i-th basis vector.
Teuchos::RCP< V > clone() const
Clone to make a new (uninitialized) vector.
void plus(const V &x)
Compute , where .
Variant on ROL::StdVector with complex entries. Perhaps this can be accomplished with partial templat...