59 #include "ROL_Sacado_Objective.hpp" 65 #include "Teuchos_oblackholestream.hpp" 66 #include "Teuchos_GlobalMPISession.hpp" 67 #include "Teuchos_XMLParameterListHelpers.hpp" 75 int main(
int argc,
char **argv)
77 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
80 int iprint = argc - 1;
81 Teuchos::RCP<std::ostream> outStream;
82 Teuchos::oblackholestream bhs;
84 outStream = Teuchos::rcp(&std::cout,
false);
86 outStream = Teuchos::rcp(&bhs,
false);
94 Sacado_Objective<RealT,Zakharov> obj;
99 Teuchos::RCP<Teuchos::ParameterList> parlist = Teuchos::rcp(
new Teuchos::ParameterList());
100 std::string paramfile =
"parameters.xml";
101 Teuchos::updateParametersFromXmlFile(paramfile,parlist.ptr());
107 Teuchos::RCP<std::vector<RealT> > x_rcp = Teuchos::rcp(
new std::vector<RealT> (dim, 0.0) );
109 for (
int i=0; i<dim; i++) {
116 algo.run(x, obj,
true, *outStream);
119 Teuchos::RCP<std::vector<RealT> > xtrue_rcp = Teuchos::rcp(
new std::vector<RealT> (dim, 0.0) );
125 *outStream << std::scientific <<
"\n Absolute Error: " << abserr << std::endl;
126 if ( abserr > sqrt(ROL_EPSILON<RealT>()) ) {
130 catch (std::logic_error err) {
131 *outStream << err.what() <<
"\n";
136 std::cout <<
"End Result: TEST FAILED\n";
138 std::cout <<
"End Result: TEST PASSED\n";
int main(int argc, char **argv)
void axpy(const Real alpha, const Vector< Real > &x)
Compute where .
Provides the std::vector implementation of the ROL::Vector interface.
Provides an interface to run optimization algorithms.
Real norm() const
Returns where .