113 const Real one(1), xnorm(x.
norm()), ctol(std::min(atol_,rtol_*xnorm));
114 Real norm1(0), norm2(0), rnorm(0);
115 p_->zero(); q_->zero();
116 std::ios_base::fmtflags streamFlags(stream.flags());
117 if (verbosity_ > 2) {
118 stream << std::scientific << std::setprecision(6);
120 stream <<
" Polyhedral Projection using Dykstra's Algorithm" << std::endl;
122 stream << std::setw(6) << std::left <<
"iter";
123 stream << std::setw(15) << std::left <<
"con norm";
124 stream << std::setw(15) << std::left <<
"bnd norm";
125 stream << std::setw(15) << std::left <<
"error";
126 stream << std::setw(15) << std::left <<
"tol";
129 for (
int cnt=0; cnt < maxit_; ++cnt) {
131 tmp_->set(x); tmp_->plus(*p_);
132 project_con(*y_,*tmp_);
133 p_->set(*tmp_); p_->axpy(-one,*y_);
135 tmp_->set(x); tmp_->axpy(-one,*y_);
136 norm1 = tmp_->norm();
138 tmp_->set(*y_); tmp_->plus(*q_);
139 project_bnd(x,*tmp_);
140 q_->set(*tmp_); q_->axpy(-one,x);
142 tmp_->set(x); tmp_->axpy(-one,*y_);
143 norm2 = tmp_->norm();
147 rnorm = std::sqrt(norm1*norm1 + norm2*norm2);
148 if (verbosity_ > 2) {
150 stream << std::setw(6) << std::left << cnt;
151 stream << std::setw(15) << std::left << norm1;
152 stream << std::setw(15) << std::left << norm2;
153 stream << std::setw(15) << std::left << rnorm;
154 stream << std::setw(15) << std::left << ctol;
157 if (rnorm <= ctol)
break;
159 if (verbosity_ > 2) {
164 stream <<
">>> ROL::PolyhedralProjection::project : Projection may be inaccurate! rnorm = ";
165 stream << rnorm <<
" rtol = " << ctol << std::endl;
167 stream.flags(streamFlags);
DykstraProjection(const Vector< Real > &xprim, const Vector< Real > &xdual, const Ptr< BoundConstraint< Real > > &bnd, const Ptr< Constraint< Real > > &con, const Vector< Real > &mul, const Vector< Real > &res)