44#include "Teuchos_GlobalMPISession.hpp"
57using size_type =
typename std::vector<RealT>::size_type;
64template<
typename Real>
78 auto result = 0.25*( w->dot(*w) - z->dot(*z) );
93int main(
int argc,
char* argv[] ) {
97 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
100 auto outStream = makeStreamPtr( std::cout, argc > 1 );
103 RealT errtol = std::sqrt(ROL_EPSILON<RealT>());
111 auto xp = makePtr<std::vector<RealT>>(N);
112 auto x = makePtr<StdVector<RealT>>(xp);
118 RandomizeVector( *x );
119 RandomizeVector( *y );
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";
typename PV< Real >::size_type size_type
Defines a no-output stream class ROL::NullStream and a function makeStreamPtr which either wraps a re...
Defines the linear algebra of vector space on a generic partitioned vector.
Defines the linear algebra or vector space interface.
VectorWorkspace< Real > workspace_
void status(std::ostream &os) const
Real dot(const Vector< Real > &x, const Vector< Real > &y)
int main(int argc, char *argv[])