52 #include "Teuchos_GlobalMPISession.hpp"
59 int main(
int argc,
char *argv[]) {
61 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
64 int iprint = argc - 1;
65 ROL::Ptr<std::ostream> outStream;
68 outStream = ROL::makePtrFromRef(std::cout);
70 outStream = ROL::makePtrFromRef(bhs);
74 RealT errtol = ROL::ROL_THRESHOLD<RealT>();
88 RealT left = -1e0, right = 1e0;
96 auto consistency = x.
checkVector(y, z,
true, *outStream);
100 if (checkvec.
norm() > std::sqrt(ROL::ROL_EPSILON<RealT>())) errorFlag++;
104 auto zp = x.
basis(0);
105 RealT znorm = zp->norm();
106 *outStream <<
"Norm of ROL::Vector z (first basis vector): " << znorm <<
"\n";
107 if ( std::abs(znorm-1.0) > errtol ) {
108 *outStream <<
"---> POSSIBLE ERROR ABOVE!\n";
115 *outStream <<
"\nNorm of ROL::Vector z ('middle' basis vector): " << znorm <<
"\n";
117 if ( std::abs(znorm-1.0) > errtol ) {
118 *outStream <<
"---> POSSIBLE ERROR ABOVE!\n";
125 *outStream <<
"\nNorm of ROL::Vector z (last basis vector): " << znorm <<
"\n";
126 if ( std::abs(znorm-1.0) > errtol ) {
127 *outStream <<
"---> POSSIBLE ERROR ABOVE!\n";
133 consistency = x.
checkVector(x, x,
true, *outStream);
134 if (checkvec.
norm() > 0.0) {
139 catch (std::logic_error& err) {
140 *outStream << err.what() <<
"\n";
144 if (errorFlag != 0) std::cout <<
"End Result: TEST FAILED\n";
145 else std::cout <<
"End Result: TEST PASSED\n";
void scale(const Real alpha)
Compute where .
Ptr< Vector< Real > > basis(const int i) const
Return i-th basis vector.
void randomize(const Real l=0.0, const Real u=1.0)
Set vector to be uniform random between [l,u].
Contains definitions of custom data types in ROL.
virtual std::vector< Real > checkVector(const Vector< Real > &x, const Vector< Real > &y, const bool printToStream=true, std::ostream &outStream=std::cout) const
Verify vector-space methods.
Defines a no-output stream class ROL::NullStream and a function makeStreamPtr which either wraps a re...
Real norm() const
Returns where .
Provides the ROL::Vector interface for scalar values, to be used, for example, with scalar constraint...
basic_nullstream< char, char_traits< char >> nullstream
int main(int argc, char *argv[])