17 #include "Teuchos_GlobalMPISession.hpp"
24 int main(
int argc,
char *argv[]) {
26 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
29 int iprint = argc - 1;
30 ROL::Ptr<std::ostream> outStream;
33 outStream = ROL::makePtrFromRef(std::cout);
35 outStream = ROL::makePtrFromRef(bhs);
39 RealT errtol = ROL::ROL_THRESHOLD<RealT>();
53 RealT left = -1e0, right = 1e0;
61 auto consistency = x.
checkVector(y, z,
true, *outStream);
65 if (checkvec.
norm() > std::sqrt(ROL::ROL_EPSILON<RealT>())) errorFlag++;
70 RealT znorm = zp->norm();
71 *outStream <<
"Norm of ROL::Vector z (first basis vector): " << znorm <<
"\n";
72 if ( std::abs(znorm-1.0) > errtol ) {
73 *outStream <<
"---> POSSIBLE ERROR ABOVE!\n";
80 *outStream <<
"\nNorm of ROL::Vector z ('middle' basis vector): " << znorm <<
"\n";
82 if ( std::abs(znorm-1.0) > errtol ) {
83 *outStream <<
"---> POSSIBLE ERROR ABOVE!\n";
90 *outStream <<
"\nNorm of ROL::Vector z (last basis vector): " << znorm <<
"\n";
91 if ( std::abs(znorm-1.0) > errtol ) {
92 *outStream <<
"---> POSSIBLE ERROR ABOVE!\n";
98 consistency = x.
checkVector(x, x,
true, *outStream);
99 if (checkvec.
norm() > 0.0) {
104 catch (std::logic_error& err) {
105 *outStream << err.what() <<
"\n";
109 if (errorFlag != 0) std::cout <<
"End Result: TEST FAILED\n";
110 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...
basic_nullstream< char, std::char_traits< char >> nullstream
Real norm() const
Returns where .
Provides the ROL::Vector interface for scalar values, to be used, for example, with scalar constraint...
int main(int argc, char *argv[])