10 #include "Teuchos_GlobalMPISession.hpp"
30 template<
typename Real>
44 auto result = 0.25*( w->dot(*w) - z->dot(*z) );
59 int main(
int argc,
char* argv[] ) {
63 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
69 RealT errtol = std::sqrt(ROL_EPSILON<RealT>());
77 auto xp = makePtr<std::vector<RealT>>(N);
78 auto x = makePtr<StdVector<RealT>>(xp);
87 auto result = 0.5*polar.
dot(*x,*y);
88 result += 0.5*polar.
dot(*y,*x);
90 auto x_dot_y = x->dot(*y);
91 errorFlag += ( std::abs( x_dot_y - result ) > errtol );
93 *outStream << std::setprecision(16) << x_dot_y << std::endl;
94 *outStream << std::setprecision(16) << result << std::endl;
102 catch (std::logic_error& err) {
103 *outStream << err.what() <<
"\n";
108 std::cout <<
"End Result: TEST FAILED\n";
110 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[])