44 #include "Teuchos_GlobalMPISession.hpp"
64 template<
typename Real>
78 auto result = 0.25*( w->dot(*w) - z->dot(*z) );
93 int main(
int argc,
char* argv[] ) {
97 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
103 RealT errtol = std::sqrt(ROL_EPSILON<RealT>());
111 auto xp = makePtr<std::vector<RealT>>(N);
112 auto x = makePtr<StdVector<RealT>>(xp);
121 auto result = 0.5*polar.
dot(*x,*y);
122 result += 0.5*polar.
dot(*y,*x);
124 auto x_dot_y = x->dot(*y);
125 errorFlag += ( std::abs( x_dot_y - result ) > errtol );
127 *outStream << std::setprecision(16) << x_dot_y << std::endl;
128 *outStream << std::setprecision(16) << result << std::endl;
136 catch (std::logic_error& err) {
137 *outStream << err.what() <<
"\n";
142 std::cout <<
"End Result: TEST FAILED\n";
144 std::cout <<
"End Result: TEST PASSED\n";
static Ptr< PartitionedVector > create(std::initializer_list< Vp > vs)
typename PV< Real >::size_type size_type
VectorWorkspace< Real > workspace_
void RandomizeVector(Vector< Real > &x, const Real &lower=0.0, const Real &upper=1.0)
Fill a ROL::Vector with uniformly-distributed random numbers in the interval [lower,upper].
Defines the linear algebra or vector space interface.
Defines a no-output stream class ROL::NullStream and a function makeStreamPtr which either wraps a re...
Ptr< ostream > makeStreamPtr(ostream &os, bool noSuppressOutput=true)
VectorWorkspace< Real > workspace_
Real dot(const Vector< Real > &x, const Vector< Real > &y)
void status(std::ostream &os) const
int main(int argc, char *argv[])