52 #include "Teuchos_GlobalMPISession.hpp"
58 constexpr
auto dim = 100u;
60 int main(
int argc,
char *argv[]) {
62 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
66 int iprint = argc - 1;
67 ROL::Ptr<std::ostream> outStream;
69 if (iprint > 0) outStream = ROL::makePtrFromRef(std::cout);
70 else outStream = ROL::makePtrFromRef(bhs);
72 auto print_pool_count = [&outStream]() {
74 <<
" Vectors from the pool" << std::endl;
79 RealT errtol = ROL::ROL_THRESHOLD<RealT>();
97 auto consistency = x.
checkVector(y, z,
true, *outStream);
100 if (checkvec.
norm() > std::sqrt(ROL::ROL_EPSILON<RealT>())) errorFlag++;
106 RealT znorm = zp->norm();
107 *outStream <<
"Norm of ROL::Vector z (first basis vector): " << znorm <<
"\n";
108 if ( std::abs(znorm-1.0) > errtol ) {
109 *outStream <<
"---> POSSIBLE ERROR ABOVE!\n";
116 *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) {
140 catch (std::logic_error& err) {
141 *outStream << err.what() <<
"\n";
147 if (errorFlag != 0) std::cout <<
"End Result: TEST FAILED\n";
148 else std::cout <<
"End Result: TEST PASSED\n";
static std::size_t pool_count()
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...
virtual Ptr< Vector< Real > > clone() const
Clone to make a new (uninitialized) vector.
Provides the std::array implementation of the ROL::Vector interface.
void scale(const Real alpha)
Compute where .
Real norm() const
Returns where .
Provides the ROL::Vector interface for scalar values, to be used, for example, with scalar constraint...
static void initialize_pool()
basic_nullstream< char, char_traits< char >> nullstream
int main(int argc, char *argv[])
void randomize(const Real l=-1.0, const Real u=1.0)
Set vector to be uniform random between [l,u].
Ptr< Vector< Real > > basis(const int i) const
Return i-th basis vector.