83 SV &Hvs =
dynamic_cast<SV&
>(Hv);
86 const SV &vs =
dynamic_cast<const SV&
>(v);
87 ROL::Ptr<const vector> vp = vs.
getVector();
91 const char TRANS =
'N';
99 std::vector<int> ipiv(n);
105 lapack_.GTTRF(n,&dl[0],&d[0],&du[0],&du2[0],&ipiv[0],&info);
108 lapack_.GTTRS(TRANS,n,NRHS,&dl[0],&d[0],&du[0],&du2[0],&ipiv[0],&(*Hvp)[0],n,&info);
118int main(
int argc,
char *argv[]) {
120 typedef std::vector<RealT> vector;
123 typedef typename vector::size_type luint;
125 Teuchos::GlobalMPISession mpiSession(&argc, &argv);
127 int iprint = argc - 1;
128 ROL::Ptr<std::ostream> outStream;
131 outStream = ROL::makePtrFromRef(std::cout);
133 outStream = ROL::makePtrFromRef(bhs);
139 ROL::ParameterList parlist;
140 ROL::ParameterList &gList = parlist.sublist(
"General");
141 ROL::ParameterList &kList = gList.sublist(
"Krylov");
143 kList.set(
"Type",
"MINRES");
144 kList.set(
"Iteration Limit",20);
145 kList.set(
"Absolute Tolerance",1.e-8);
146 kList.set(
"Relative Tolerance",1.e-6);
147 kList.set(
"Use Initial Guess",
false);
151 auto xp = ROL::makePtr<vector>(
dim,0.0);
152 auto yp = ROL::makePtr<vector>(
dim,0.0);
153 auto zp = ROL::makePtr<vector>(
dim,0.0);
154 auto bp = ROL::makePtr<vector>(
dim,0.0);
180 auto krylov = ROL::KrylovFactory<RealT>( parlist );
185 krylov->run(z,T,b,I,iter,flag);
187 *outStream << std::setw(10) <<
"Exact"
188 << std::setw(10) <<
"LAPACK"
189 << std::setw(10) <<
"MINRES" << std::endl;
190 *outStream <<
"---------------------------------" << std::endl;
192 for(luint k=0;k<
dim;++k) {
193 *outStream << std::setw(10) << (*xp)[k] <<
" "
194 << std::setw(10) << (*yp)[k] <<
" "
195 << std::setw(10) << (*zp)[k] <<
" " << std::endl;
198 *outStream <<
"MINRES performed " << iter <<
" iterations." << std::endl;
202 if( z.norm() > std::sqrt(ROL::ROL_EPSILON<RealT>()) ) {
207 catch (std::logic_error& err) {
208 *outStream << err.what() <<
"\n";
213 std::cout <<
"End Result: TEST FAILED\n";
215 std::cout <<
"End Result: TEST PASSED\n";
void RandomizeVector(Vector< Real > &x, const Real &lower=0.0, const Real &upper=1.0)
Fill a ROL::Vector with uniformly-distributed random numbers in the interval [lower,...