44 #ifndef ROL_VECTORPROFILER_H
45 #define ROL_VECTORPROFILER_H
69 template<
class Ordinal>
98 template<
class Ordinal,
class Real>
101 template<
class Ordinal,
class Real>
106 template<
class Ordinal,
class Real>
108 outStream <<
"Total Vector Function Calls" << std::endl;
109 outStream <<
"---------------------------" << std::endl;
110 outStream <<
"Constructor : " << x.
functionCalls_.constructor_ << std::endl;
111 outStream <<
"Destructor : " << x.
functionCalls_.destructor_ << std::endl;
122 outStream <<
"dimension : " << x.
functionCalls_.dimension_ << std::endl;
123 outStream <<
"applyUnary : " << x.
functionCalls_.applyUnary_ << std::endl;
124 outStream <<
"applyBinary : " << x.
functionCalls_.applyBinary_ << std::endl;
125 outStream <<
"reduce : " << x.
functionCalls_.reduce_ << std::endl;
126 outStream <<
"setScalar : " << x.
functionCalls_.setScalar_ << std::endl;
127 outStream <<
"randomize : " << x.
functionCalls_.randomize_ << std::endl;
132 template<
class Ordinal,
class Real>
138 ROL::Ptr<Vector<Real> >
v_;
144 ROL::Ptr<ProfiledVector> pv = ROL::nullPtr;
145 pv = ROL::dynamicPtrCast<ProfiledVector>(v);
146 ROL_TEST_FOR_EXCEPTION( pv != ROL::nullPtr, std::logic_error,
"ProfiledVector class "
147 "cannot encapsulate a ProfiledVector object!");
181 ROL::Ptr<Vector<Real> >
clone()
const {
183 return ROL::makePtr<ProfiledVector>(
v_->clone() );
189 return v_->axpy(alpha,*xp);
197 ROL::Ptr<Vector<Real> >
basis(
const int i )
const {
199 return ROL::makePtr<ProfiledVector>(
v_->basis(i) );
204 return v_->dimension();
227 void applyUnary(
const Elementwise::UnaryFunction<Real> &f ) {
234 v_->applyBinary(f,x);
237 Real
reduce(
const Elementwise::ReductionOp<Real> &r )
const {
239 return v_->reduce(r);
252 void print( std::ostream &outStream )
const {
253 v_->print(outStream);
264 #endif // ROL_RANDOMVECTOR_H