53 #include "Teuchos_oblackholestream.hpp" 54 #include "Teuchos_GlobalMPISession.hpp" 61 int main(
int argc,
char *argv[]) {
63 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
66 int iprint = argc - 1;
67 Teuchos::RCP<std::ostream> outStream;
68 Teuchos::oblackholestream bhs;
70 outStream = Teuchos::rcp(&std::cout,
false);
72 outStream = Teuchos::rcp(&bhs,
false);
87 Teuchos::ArrayRCP<ElementT> y_arcp(dim,0);
93 RealT left = -1e0, right = 1e0;
96 for (
int i=0; i<dim; i++) {
97 x_rawp[i] = ( (
RealT)rand() / (
RealT)RAND_MAX ) * (right - left) + left;
98 y_arcp[i] = ( (
RealT)rand() / (
RealT)RAND_MAX ) * (right - left) + left;
103 std::vector<RealT> consistency = x.
checkVector(y, z,
true, *outStream);
111 Teuchos::RCP<ROL::Vector<RealT> > zp = x.
clone();
113 RealT znorm = zp->norm();
114 *outStream <<
"Norm of ROL::Vector z (first basis vector): " << znorm <<
"\n";
115 if ( std::abs(znorm-1.0) > errtol ) {
116 *outStream <<
"---> POSSIBLE ERROR ABOVE!\n";
122 *outStream <<
"\nNorm of ROL::Vector z ('middle' basis vector): " << znorm <<
"\n";
123 if ( std::abs(znorm-1.0) > errtol ) {
124 *outStream <<
"---> POSSIBLE ERROR ABOVE!\n";
130 *outStream <<
"\nNorm of ROL::Vector z (last basis vector): " << znorm <<
"\n";
131 if ( std::abs(znorm-1.0) > errtol ) {
132 *outStream <<
"---> POSSIBLE ERROR ABOVE!\n";
138 consistency = x.
checkVector(x, x,
true, *outStream);
139 if (checkvec.
norm() > 0.0) {
145 catch (std::logic_error err) {
146 *outStream << err.what() <<
"\n";
151 std::cout <<
"End Result: TEST FAILED\n";
153 std::cout <<
"End Result: TEST PASSED\n";
Teuchos::ArrayRCP< Element > getVector() const
Contains definitions of custom data types in ROL.
static const double ROL_THRESHOLD
Tolerance for various equality tests.
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.
Real norm() const
Returns where .
Provides the std::vector implementation of the ROL::Vector interface.
void scale(const Real alpha)
Compute where .
int main(int argc, char *argv[])
Provides the C array implementation of the ROL::Vector interface for use with NumPy->C Array passing ...
Teuchos::RCP< Vector< Real > > basis(const int i) const
Return i-th basis vector.
Teuchos::RCP< Vector< Real > > clone() const
Clone to make a new (uninitialized) vector.
static const double ROL_EPSILON
Platform-dependent machine epsilon.