148 const Real one(1), xnorm(x.
norm()), ctol(std::min(atol_,rtol_*xnorm));
149 Real norm1(0), norm2(0), rnorm(0);
150 p_->zero(); q_->zero();
151 std::ios_base::fmtflags streamFlags(stream.flags());
152 if (verbosity_ > 2) {
153 stream << std::scientific << std::setprecision(6);
155 stream <<
" Polyhedral Projection using Dykstra's Algorithm" << std::endl;
157 stream << std::setw(6) << std::left <<
"iter";
158 stream << std::setw(15) << std::left <<
"con norm";
159 stream << std::setw(15) << std::left <<
"bnd norm";
160 stream << std::setw(15) << std::left <<
"error";
161 stream << std::setw(15) << std::left <<
"tol";
164 for (
int cnt=0; cnt < maxit_; ++cnt) {
166 tmp_->set(x); tmp_->plus(*p_);
167 project_con(*y_,*tmp_);
168 p_->set(*tmp_); p_->axpy(-one,*y_);
170 tmp_->set(x); tmp_->axpy(-one,*y_);
171 norm1 = tmp_->norm();
173 tmp_->set(*y_); tmp_->plus(*q_);
174 project_bnd(x,*tmp_);
175 q_->set(*tmp_); q_->axpy(-one,x);
177 tmp_->set(x); tmp_->axpy(-one,*y_);
178 norm2 = tmp_->norm();
182 rnorm = std::sqrt(norm1*norm1 + norm2*norm2);
183 if (verbosity_ > 2) {
185 stream << std::setw(6) << std::left << cnt;
186 stream << std::setw(15) << std::left << norm1;
187 stream << std::setw(15) << std::left << norm2;
188 stream << std::setw(15) << std::left << rnorm;
189 stream << std::setw(15) << std::left << ctol;
192 if (rnorm <= ctol)
break;
194 if (verbosity_ > 2) {
199 stream <<
">>> ROL::PolyhedralProjection::project : Projection may be inaccurate! rnorm = ";
200 stream << rnorm <<
" rtol = " << ctol << std::endl;
202 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)