54 #include "Teuchos_LAPACK.hpp"
82 void update(std::vector<Real> &u,
const std::vector<Real> &s,
const Real alpha=1.0)
const {
83 for (
unsigned i=0; i<u.size(); i++) {
88 void axpy(std::vector<Real> &out,
const Real a,
const std::vector<Real> &x,
const std::vector<Real> &y)
const {
89 for (
unsigned i=0; i < x.size(); i++) {
90 out[i] = a*x[i] + y[i];
94 void scale(std::vector<Real> &u,
const Real alpha=0.0)
const {
95 for (
unsigned i=0; i<u.size(); i++) {
100 void linear_solve(std::vector<Real> &u, std::vector<Real> &dl, std::vector<Real> &d, std::vector<Real> &du,
101 const std::vector<Real> &r,
const bool transpose =
false)
const {
102 if ( r.size() == 1 ) {
103 u.resize(1,r[0]/d[0]);
105 else if ( r.size() == 2 ) {
107 Real det = d[0]*d[1] - dl[0]*du[0];
108 u[0] = (d[1]*r[0] - du[0]*r[1])/det;
109 u[1] = (d[0]*r[1] - dl[0]*r[0])/det;
112 u.assign(r.begin(),r.end());
114 Teuchos::LAPACK<int,Real> lp;
115 std::vector<Real> du2(r.size()-2,0.0);
116 std::vector<int> ipiv(r.size(),0);
121 lp.GTTRF(dim,&dl[0],&d[0],&du[0],&du2[0],&ipiv[0],&info);
126 lp.GTTRS(trans,dim,nhrs,&dl[0],&d[0],&du[0],&du2[0],&ipiv[0],&u[0],ldb,&info);
131 BurgersFEM(
int nx = 128, Real nl = 1.0, Real cH1 = 1.0, Real cL2 = 1.0)
140 nu_ = std::pow(10.0,nu-2.0);
158 Real
compute_L2_dot(
const std::vector<Real> &x,
const std::vector<Real> &y)
const {
160 Real c = (((int)x.size()==
nx_) ? 4.0 : 2.0);
161 for (
unsigned i=0; i<x.size(); i++) {
163 ip +=
dx_/6.0*(c*x[i] + x[i+1])*y[i];
165 else if ( i == x.size()-1 ) {
166 ip +=
dx_/6.0*(x[i-1] + c*x[i])*y[i];
169 ip +=
dx_/6.0*(x[i-1] + 4.0*x[i] + x[i+1])*y[i];
181 void apply_mass(std::vector<Real> &Mu,
const std::vector<Real> &u )
const {
182 Mu.resize(u.size(),0.0);
183 Real c = (((int)u.size()==
nx_) ? 4.0 : 2.0);
184 for (
unsigned i=0; i<u.size(); i++) {
186 Mu[i] =
dx_/6.0*(c*u[i] + u[i+1]);
188 else if ( i == u.size()-1 ) {
189 Mu[i] =
dx_/6.0*(u[i-1] + c*u[i]);
192 Mu[i] =
dx_/6.0*(u[i-1] + 4.0*u[i] + u[i+1]);
199 unsigned nx = u.size();
201 std::vector<Real> dl(nx-1,
dx_/6.0);
202 std::vector<Real> d(nx,2.0*
dx_/3.0);
203 std::vector<Real> du(nx-1,
dx_/6.0);
204 if ( (
int)nx !=
nx_ ) {
213 std::vector<Real> u(
nx_,0.0), Mu(
nx_,0.0), iMMu(
nx_,0.0), diff(
nx_,0.0);
214 for (
int i = 0; i <
nx_; i++) {
215 u[i] = 2.0*(Real)rand()/(Real)RAND_MAX - 1.0;
219 axpy(diff,-1.0,iMMu,u);
222 outStream <<
"\nTest Inverse State Mass Matrix\n";
223 outStream <<
" ||u - inv(M)Mu|| = " << error <<
"\n";
224 outStream <<
" ||u|| = " << normu <<
"\n";
225 outStream <<
" Relative Error = " << error/normu <<
"\n";
228 u.resize(nx_+2,0.0); Mu.resize(nx_+2,0.0); iMMu.resize(nx_+2,0.0); diff.resize(nx_+2,0.0);
229 for (
int i = 0; i < nx_+2; i++) {
230 u[i] = 2.0*(Real)rand()/(Real)RAND_MAX - 1.0;
234 axpy(diff,-1.0,iMMu,u);
237 outStream <<
"\nTest Inverse Control Mass Matrix\n";
238 outStream <<
" ||z - inv(M)Mz|| = " << error <<
"\n";
239 outStream <<
" ||z|| = " << normu <<
"\n";
240 outStream <<
" Relative Error = " << error/normu <<
"\n";
248 Real
compute_H1_dot(
const std::vector<Real> &x,
const std::vector<Real> &y)
const {
250 for (
int i=0; i<
nx_; i++) {
252 ip +=
cL2_*
dx_/6.0*(4.0*x[i] + x[i+1])*y[i];
253 ip +=
cH1_*(2.0*x[i] - x[i+1])/
dx_*y[i];
255 else if ( i == nx_-1 ) {
256 ip +=
cL2_*
dx_/6.0*(x[i-1] + 4.0*x[i])*y[i];
257 ip +=
cH1_*(2.0*x[i] - x[i-1])/
dx_*y[i];
260 ip +=
cL2_*
dx_/6.0*(x[i-1] + 4.0*x[i] + x[i+1])*y[i];
261 ip +=
cH1_*(2.0*x[i] - x[i-1] - x[i+1])/
dx_*y[i];
273 void apply_H1(std::vector<Real> &Mu,
const std::vector<Real> &u )
const {
275 for (
int i=0; i<
nx_; i++) {
277 Mu[i] =
cL2_*
dx_/6.0*(4.0*u[i] + u[i+1])
278 +
cH1_*(2.0*u[i] - u[i+1])/
dx_;
280 else if ( i == nx_-1 ) {
281 Mu[i] =
cL2_*
dx_/6.0*(u[i-1] + 4.0*u[i])
282 +
cH1_*(2.0*u[i] - u[i-1])/
dx_;
285 Mu[i] =
cL2_*
dx_/6.0*(u[i-1] + 4.0*u[i] + u[i+1])
286 +
cH1_*(2.0*u[i] - u[i-1] - u[i+1])/
dx_;
301 std::vector<Real> u(
nx_,0.0), Mu(
nx_,0.0), iMMu(
nx_,0.0), diff(
nx_,0.0);
302 for (
int i = 0; i <
nx_; i++) {
303 u[i] = 2.0*(Real)rand()/(Real)RAND_MAX - 1.0;
307 axpy(diff,-1.0,iMMu,u);
310 outStream <<
"\nTest Inverse State H1 Matrix\n";
311 outStream <<
" ||u - inv(M)Mu|| = " << error <<
"\n";
312 outStream <<
" ||u|| = " << normu <<
"\n";
313 outStream <<
" Relative Error = " << error/normu <<
"\n";
322 const std::vector<Real> &z)
const {
325 for (
int i=0; i<
nx_; i++) {
328 r[i] =
nu_/
dx_*(2.0*u[i]-u[i+1]);
331 r[i] =
nu_/
dx_*(2.0*u[i]-u[i-1]);
334 r[i] =
nu_/
dx_*(2.0*u[i]-u[i-1]-u[i+1]);
338 r[i] +=
nl_*u[i+1]*(u[i]+u[i+1])/6.0;
341 r[i] -=
nl_*u[i-1]*(u[i-1]+u[i])/6.0;
344 r[i] -=
dx_/6.0*(z[i]+4.0*z[i+1]+z[i+2]);
358 std::vector<Real> &d,
359 std::vector<Real> &du,
360 const std::vector<Real> &u)
const {
369 for (
int i=0; i<
nx_; i++) {
371 dl[i] +=
nl_*(-2.0*u[i]-u[i+1])/6.0;
372 d[i] +=
nl_*u[i+1]/6.0;
375 d[i] -=
nl_*u[i-1]/6.0;
376 du[i-1] +=
nl_*(u[i-1]+2.0*u[i])/6.0;
386 const std::vector<Real> &v,
387 const std::vector<Real> &u,
388 const std::vector<Real> &z)
const {
390 for (
int i = 0; i <
nx_; i++) {
393 jv[i] += -
nu_/
dx_*v[i-1]-
nl_*(u[i-1]/6.0*v[i]+(u[i]+2.0*u[i-1])/6.0*v[i-1]);
396 jv[i] += -
nu_/
dx_*v[i+1]+
nl_*(u[i+1]/6.0*v[i]+(u[i]+2.0*u[i+1])/6.0*v[i+1]);
399 jv[ 0] -=
nl_*
u0_/6.0*v[0];
400 jv[nx_-1] +=
nl_*
u1_/6.0*v[nx_-1];
405 const std::vector<Real> &v,
406 const std::vector<Real> &u,
407 const std::vector<Real> &z)
const {
409 std::vector<Real> d(
nx_,0.0);
410 std::vector<Real> dl(
nx_-1,0.0);
411 std::vector<Real> du(
nx_-1,0.0);
419 const std::vector<Real> &v,
420 const std::vector<Real> &u,
421 const std::vector<Real> &z)
const {
423 for (
int i = 0; i <
nx_; i++) {
424 ajv[i] =
nu_/
dx_*2.0*v[i];
426 ajv[i] += -
nu_/
dx_*v[i-1]-
nl_*(u[i-1]/6.0*v[i]
427 -(u[i-1]+2.0*u[i])/6.0*v[i-1]);
430 ajv[i] += -
nu_/
dx_*v[i+1]+
nl_*(u[i+1]/6.0*v[i]
431 -(u[i+1]+2.0*u[i])/6.0*v[i+1]);
434 ajv[ 0] -=
nl_*
u0_/6.0*v[0];
435 ajv[nx_-1] +=
nl_*
u1_/6.0*v[nx_-1];
440 const std::vector<Real> &v,
441 const std::vector<Real> &u,
442 const std::vector<Real> &z)
const {
444 std::vector<Real> d(
nx_,0.0);
445 std::vector<Real> du(
nx_-1,0.0);
446 std::vector<Real> dl(
nx_-1,0.0);
457 const std::vector<Real> &v,
458 const std::vector<Real> &u,
459 const std::vector<Real> &z)
const {
460 for (
int i=0; i<
nx_; i++) {
462 jv[i] = -
dx_/6.0*(v[i]+4.0*v[i+1]+v[i+2]);
468 const std::vector<Real> &v,
469 const std::vector<Real> &u,
470 const std::vector<Real> &z)
const {
471 for (
int i=0; i<
nx_+2; i++) {
473 jv[i] = -
dx_/6.0*v[i];
476 jv[i] = -
dx_/6.0*(4.0*v[i-1]+v[i]);
478 else if ( i == nx_ ) {
479 jv[i] = -
dx_/6.0*(4.0*v[i-1]+v[i-2]);
481 else if ( i == nx_+1 ) {
482 jv[i] = -
dx_/6.0*v[i-2];
485 jv[i] = -
dx_/6.0*(v[i-2]+4.0*v[i-1]+v[i]);
494 const std::vector<Real> &w,
495 const std::vector<Real> &v,
496 const std::vector<Real> &u,
497 const std::vector<Real> &z)
const {
498 for (
int i=0; i<
nx_; i++) {
502 ahwv[i] += (w[i]*v[i+1] - w[i+1]*(2.0*v[i]+v[i+1]))/6.0;
505 ahwv[i] += (w[i-1]*(v[i-1]+2.0*v[i]) - w[i]*v[i-1])/6.0;
511 const std::vector<Real> &w,
512 const std::vector<Real> &v,
513 const std::vector<Real> &u,
514 const std::vector<Real> &z) {
515 ahwv.assign(u.size(),0.0);
518 const std::vector<Real> &w,
519 const std::vector<Real> &v,
520 const std::vector<Real> &u,
521 const std::vector<Real> &z) {
522 ahwv.assign(z.size(),0.0);
525 const std::vector<Real> &w,
526 const std::vector<Real> &v,
527 const std::vector<Real> &u,
528 const std::vector<Real> &z) {
529 ahwv.assign(z.size(),0.0);
536 ROL::Ptr<std::vector<Real> >
vec_;
537 ROL::Ptr<BurgersFEM<Real> >
fem_;
548 const std::vector<Real>& xval = *ex.
getVector();
549 std::copy(xval.begin(),xval.end(),
vec_->begin());
554 const std::vector<Real>& xval = *ex.
getVector();
557 (*vec_)[i] += xval[i];
570 const std::vector<Real>& xval = *ex.
getVector();
571 return fem_->compute_L2_dot(xval,*
vec_);
576 val = std::sqrt(
dot(*
this) );
580 ROL::Ptr<ROL::Vector<Real> >
clone()
const {
581 return ROL::makePtr<L2VectorPrimal>( ROL::makePtr<std::vector<Real>>(
vec_->size(),0.0),
fem_);
592 ROL::Ptr<ROL::Vector<Real> >
basis(
const int i )
const {
593 ROL::Ptr<L2VectorPrimal> e
594 = ROL::makePtr<L2VectorPrimal>( ROL::makePtr<std::vector<Real>>(
vec_->size(),0.0),
fem_);
595 (*e->getVector())[i] = 1.0;
604 dual_vec_ = ROL::makePtr<L2VectorDual<Real>>(
605 ROL::makePtr<std::vector<Real>>(*vec_),
fem_);
607 fem_->apply_mass(*(ROL::constPtrCast<std::vector<Real> >(
dual_vec_->getVector())),*
vec_);
616 ROL::Ptr<std::vector<Real> >
vec_;
617 ROL::Ptr<BurgersFEM<Real> >
fem_;
628 const std::vector<Real>& xval = *ex.
getVector();
629 std::copy(xval.begin(),xval.end(),
vec_->begin());
634 const std::vector<Real>& xval = *ex.
getVector();
637 (*vec_)[i] += xval[i];
650 const std::vector<Real>& xval = *ex.
getVector();
652 std::vector<Real> Mx(dimension,0.0);
653 fem_->apply_inverse_mass(Mx,xval);
655 for (
unsigned i = 0; i <
dimension; i++) {
656 val += Mx[i]*(*vec_)[i];
663 val = std::sqrt(
dot(*
this) );
667 ROL::Ptr<ROL::Vector<Real> >
clone()
const {
668 return ROL::makePtr<L2VectorDual>( ROL::makePtr<std::vector<Real>>(
vec_->size(),0.0),
fem_);
679 ROL::Ptr<ROL::Vector<Real> >
basis(
const int i )
const {
680 ROL::Ptr<L2VectorDual> e
681 = ROL::makePtr<L2VectorDual>( ROL::makePtr<std::vector<Real>>(
vec_->size(),0.0),
fem_);
682 (*e->getVector())[i] = 1.0;
691 dual_vec_ = ROL::makePtr<L2VectorPrimal<Real>>(
692 ROL::makePtr<std::vector<Real>>(*vec_),
fem_);
694 fem_->apply_inverse_mass(*(ROL::constPtrCast<std::vector<Real> >(
dual_vec_->getVector())),*
vec_);
703 ROL::Ptr<std::vector<Real> >
vec_;
704 ROL::Ptr<BurgersFEM<Real> >
fem_;
715 const std::vector<Real>& xval = *ex.
getVector();
716 std::copy(xval.begin(),xval.end(),
vec_->begin());
721 const std::vector<Real>& xval = *ex.
getVector();
724 (*vec_)[i] += xval[i];
737 const std::vector<Real>& xval = *ex.
getVector();
738 return fem_->compute_H1_dot(xval,*
vec_);
743 val = std::sqrt(
dot(*
this) );
747 ROL::Ptr<ROL::Vector<Real> >
clone()
const {
748 return ROL::makePtr<H1VectorPrimal>( ROL::makePtr<std::vector<Real>>(
vec_->size(),0.0),
fem_);
759 ROL::Ptr<ROL::Vector<Real> >
basis(
const int i )
const {
760 ROL::Ptr<H1VectorPrimal> e
761 = ROL::makePtr<H1VectorPrimal>( ROL::makePtr<std::vector<Real>>(
vec_->size(),0.0),
fem_);
762 (*e->getVector())[i] = 1.0;
771 dual_vec_ = ROL::makePtr<H1VectorDual<Real>>(
772 ROL::makePtr<std::vector<Real>>(*vec_),
fem_);
774 fem_->apply_H1(*(ROL::constPtrCast<std::vector<Real> >(
dual_vec_->getVector())),*
vec_);
783 ROL::Ptr<std::vector<Real> >
vec_;
784 ROL::Ptr<BurgersFEM<Real> >
fem_;
795 const std::vector<Real>& xval = *ex.
getVector();
796 std::copy(xval.begin(),xval.end(),
vec_->begin());
801 const std::vector<Real>& xval = *ex.
getVector();
804 (*vec_)[i] += xval[i];
817 const std::vector<Real>& xval = *ex.
getVector();
819 std::vector<Real> Mx(dimension,0.0);
820 fem_->apply_inverse_H1(Mx,xval);
822 for (
unsigned i = 0; i <
dimension; i++) {
823 val += Mx[i]*(*vec_)[i];
830 val = std::sqrt(
dot(*
this) );
834 ROL::Ptr<ROL::Vector<Real>>
clone()
const {
835 return ROL::makePtr<H1VectorDual>( ROL::makePtr<std::vector<Real>>(
vec_->size(),0.0),
fem_);
846 ROL::Ptr<ROL::Vector<Real> >
basis(
const int i )
const {
847 ROL::Ptr<H1VectorDual> e
848 = ROL::makePtr<H1VectorDual>( ROL::makePtr<std::vector<Real>>(
vec_->size(),0.0),
fem_);
849 (*e->getVector())[i] = 1.0;
858 dual_vec_ = ROL::makePtr<H1VectorPrimal<Real>>(
859 ROL::makePtr<std::vector<Real>>(*vec_),
fem_);
861 fem_->apply_inverse_H1(*(ROL::constPtrCast<std::vector<Real> >(
dual_vec_->getVector())),*
vec_);
880 ROL::Ptr<BurgersFEM<Real> >
fem_;
885 const bool useHessian =
true)
890 ROL::Ptr<std::vector<Real> > cp =
892 ROL::Ptr<const std::vector<Real> > up =
894 ROL::Ptr<const std::vector<Real> > zp =
897 fem_->compute_residual(*cp,*up,*zp);
902 ROL::Ptr<std::vector<Real> > jvp =
904 ROL::Ptr<const std::vector<Real> > vp =
906 ROL::Ptr<const std::vector<Real> > up =
908 ROL::Ptr<const std::vector<Real> > zp =
911 fem_->apply_pde_jacobian(*jvp,*vp,*up,*zp);
916 ROL::Ptr<std::vector<Real> > jvp =
918 ROL::Ptr<const std::vector<Real> > vp =
920 ROL::Ptr<const std::vector<Real> > up =
922 ROL::Ptr<const std::vector<Real> > zp =
925 fem_->apply_control_jacobian(*jvp,*vp,*up,*zp);
930 ROL::Ptr<std::vector<Real> > ijvp =
932 ROL::Ptr<const std::vector<Real> > vp =
934 ROL::Ptr<const std::vector<Real> > up =
936 ROL::Ptr<const std::vector<Real> > zp =
939 fem_->apply_inverse_pde_jacobian(*ijvp,*vp,*up,*zp);
944 ROL::Ptr<std::vector<Real> > jvp =
946 ROL::Ptr<const std::vector<Real> > vp =
948 ROL::Ptr<const std::vector<Real> > up =
950 ROL::Ptr<const std::vector<Real> > zp =
953 fem_->apply_adjoint_pde_jacobian(*jvp,*vp,*up,*zp);
958 ROL::Ptr<std::vector<Real> > jvp =
960 ROL::Ptr<const std::vector<Real> > vp =
962 ROL::Ptr<const std::vector<Real> > up =
964 ROL::Ptr<const std::vector<Real> > zp =
967 fem_->apply_adjoint_control_jacobian(*jvp,*vp,*up,*zp);
972 ROL::Ptr<std::vector<Real> > iajvp =
974 ROL::Ptr<const std::vector<Real> > vp =
976 ROL::Ptr<const std::vector<Real> > up =
978 ROL::Ptr<const std::vector<Real> > zp =
981 fem_->apply_inverse_adjoint_pde_jacobian(*iajvp,*vp,*up,*zp);
987 ROL::Ptr<std::vector<Real> > ahwvp =
989 ROL::Ptr<const std::vector<Real> > wp =
991 ROL::Ptr<const std::vector<Real> > vp =
993 ROL::Ptr<const std::vector<Real> > up =
995 ROL::Ptr<const std::vector<Real> > zp =
998 fem_->apply_adjoint_pde_hessian(*ahwvp,*wp,*vp,*up,*zp);
1008 ROL::Ptr<std::vector<Real> > ahwvp =
1010 ROL::Ptr<const std::vector<Real> > wp =
1012 ROL::Ptr<const std::vector<Real> > vp =
1014 ROL::Ptr<const std::vector<Real> > up =
1016 ROL::Ptr<const std::vector<Real> > zp =
1019 fem_->apply_adjoint_control_pde_hessian(*ahwvp,*wp,*vp,*up,*zp);
1028 ROL::Ptr<std::vector<Real> > ahwvp =
1030 ROL::Ptr<const std::vector<Real> > wp =
1032 ROL::Ptr<const std::vector<Real> > vp =
1034 ROL::Ptr<const std::vector<Real> > up =
1036 ROL::Ptr<const std::vector<Real> > zp =
1039 fem_->apply_adjoint_pde_control_hessian(*ahwvp,*wp,*vp,*up,*zp);
1048 ROL::Ptr<std::vector<Real> > ahwvp =
1050 ROL::Ptr<const std::vector<Real> > wp =
1052 ROL::Ptr<const std::vector<Real> > vp =
1054 ROL::Ptr<const std::vector<Real> > up =
1056 ROL::Ptr<const std::vector<Real> > zp =
1059 fem_->apply_adjoint_control_hessian(*ahwvp,*wp,*vp,*up,*zp);
H1VectorPrimal< Real > DualConstraintVector
BurgersFEM(int nx=128, Real nl=1.0, Real cH1=1.0, Real cL2=1.0)
L2VectorDual(const ROL::Ptr< std::vector< Real > > &vec, const ROL::Ptr< BurgersFEM< Real > > &fem)
ROL::Ptr< std::vector< Real > > vec_
Real compute_H1_dot(const std::vector< Real > &x, const std::vector< Real > &y) const
void applyAdjointJacobian_1(ROL::Vector< Real > &ajv, const ROL::Vector< Real > &v, const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
Apply the adjoint of the partial constraint Jacobian at , , to the vector . This is the primary inter...
Real norm() const
Returns where .
void apply_mass(std::vector< Real > &Mu, const std::vector< Real > &u) const
void axpy(std::vector< Real > &out, const Real a, const std::vector< Real > &x, const std::vector< Real > &y) const
ROL::Ptr< ROL::Vector< Real > > basis(const int i) const
Return i-th basis vector.
Real dot(const ROL::Vector< Real > &x) const
Compute where .
void apply_adjoint_pde_control_hessian(std::vector< Real > &ahwv, const std::vector< Real > &w, const std::vector< Real > &v, const std::vector< Real > &u, const std::vector< Real > &z)
ROL::Ptr< std::vector< Real > > vec_
int dimension() const
Return dimension of the vector space.
ROL::Ptr< L2VectorDual< Real > > dual_vec_
void applyAdjointHessian_12(ROL::Vector< Real > &ahwv, const ROL::Vector< Real > &w, const ROL::Vector< Real > &v, const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
Apply the optimization-space derivative of the adjoint of the constraint simulation-space Jacobian at...
void plus(const ROL::Vector< Real > &x)
Compute , where .
Constraint_BurgersControl(const ROL::Ptr< BurgersFEM< Real > > &fem, const bool useHessian=true)
void apply_adjoint_pde_hessian(std::vector< Real > &ahwv, const std::vector< Real > &w, const std::vector< Real > &v, const std::vector< Real > &u, const std::vector< Real > &z) const
ROL::Ptr< BurgersFEM< Real > > fem_
H1VectorPrimal(const ROL::Ptr< std::vector< Real > > &vec, const ROL::Ptr< BurgersFEM< Real > > &fem)
Real norm() const
Returns where .
Contains definitions of custom data types in ROL.
Real dot(const ROL::Vector< Real > &x) const
Compute where .
void applyAdjointHessian_11(ROL::Vector< Real > &ahwv, const ROL::Vector< Real > &w, const ROL::Vector< Real > &v, const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
Apply the simulation-space derivative of the adjoint of the constraint simulation-space Jacobian at ...
ROL::Ptr< const std::vector< Real > > getVector() const
void plus(const ROL::Vector< Real > &x)
Compute , where .
ROL::Ptr< BurgersFEM< Real > > fem_
Real compute_H1_norm(const std::vector< Real > &r) const
Real norm() const
Returns where .
void applyInverseAdjointJacobian_1(ROL::Vector< Real > &iajv, const ROL::Vector< Real > &v, const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
Apply the inverse of the adjoint of the partial constraint Jacobian at , , to the vector ...
ROL::Ptr< std::vector< Real > > vec_
H1VectorDual(const ROL::Ptr< std::vector< Real > > &vec, const ROL::Ptr< BurgersFEM< Real > > &fem)
virtual void zero()
Set to zero vector.
ROL::Ptr< std::vector< Real > > getVector()
Defines the linear algebra or vector space interface.
H1VectorDual< Real > PrimalConstraintVector
void scale(const Real alpha)
Compute where .
L2VectorPrimal(const ROL::Ptr< std::vector< Real > > &vec, const ROL::Ptr< BurgersFEM< Real > > &fem)
Real dot(const ROL::Vector< Real > &x) const
Compute where .
H1VectorPrimal< Real > PrimalStateVector
void plus(const ROL::Vector< Real > &x)
Compute , where .
Real mesh_spacing(void) const
ROL::Ptr< ROL::Vector< Real > > clone() const
Clone to make a new (uninitialized) vector.
int dimension() const
Return dimension of the vector space.
ROL::Ptr< std::vector< Real > > vec_
void test_inverse_mass(std::ostream &outStream=std::cout)
void apply_pde_jacobian(std::vector< Real > &jv, const std::vector< Real > &v, const std::vector< Real > &u, const std::vector< Real > &z) const
ROL::Ptr< BurgersFEM< Real > > fem_
ROL::Ptr< ROL::Vector< Real > > basis(const int i) const
Return i-th basis vector.
void applyAdjointHessian_21(ROL::Vector< Real > &ahwv, const ROL::Vector< Real > &w, const ROL::Vector< Real > &v, const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
Apply the simulation-space derivative of the adjoint of the constraint optimization-space Jacobian at...
ROL::Ptr< const std::vector< Real > > getVector() const
ROL::Ptr< ROL::Vector< Real > > clone() const
Clone to make a new (uninitialized) vector.
ROL::Ptr< const std::vector< Real > > getVector() const
void set(const ROL::Vector< Real > &x)
Set where .
void scale(const Real alpha)
Compute where .
void compute_pde_jacobian(std::vector< Real > &dl, std::vector< Real > &d, std::vector< Real > &du, const std::vector< Real > &u) const
ROL::Ptr< ROL::Vector< Real > > basis(const int i) const
Return i-th basis vector.
H1VectorDual< Real > DualStateVector
void applyJacobian_1(ROL::Vector< Real > &jv, const ROL::Vector< Real > &v, const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
Apply the partial constraint Jacobian at , , to the vector .
Real compute_L2_dot(const std::vector< Real > &x, const std::vector< Real > &y) const
void linear_solve(std::vector< Real > &u, std::vector< Real > &dl, std::vector< Real > &d, std::vector< Real > &du, const std::vector< Real > &r, const bool transpose=false) const
ROL::Ptr< std::vector< Real > > getVector()
L2VectorPrimal< Real > PrimalControlVector
void apply_inverse_mass(std::vector< Real > &Mu, const std::vector< Real > &u) const
ROL::Ptr< std::vector< Real > > getVector()
ROL::Ptr< BurgersFEM< Real > > fem_
ROL::Ptr< const std::vector< Real > > getVector() const
ROL::Ptr< BurgersFEM< Real > > fem_
void update(std::vector< Real > &u, const std::vector< Real > &s, const Real alpha=1.0) const
void scale(const Real alpha)
Compute where .
void set(const ROL::Vector< Real > &x)
Set where .
void apply_adjoint_control_hessian(std::vector< Real > &ahwv, const std::vector< Real > &w, const std::vector< Real > &v, const std::vector< Real > &u, const std::vector< Real > &z)
void applyInverseJacobian_1(ROL::Vector< Real > &ijv, const ROL::Vector< Real > &v, const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
Apply the inverse partial constraint Jacobian at , , to the vector .
void compute_residual(std::vector< Real > &r, const std::vector< Real > &u, const std::vector< Real > &z) const
ROL::Ptr< ROL::Vector< Real > > clone() const
Clone to make a new (uninitialized) vector.
void set_problem_data(const Real nu, const Real f, const Real u0, const Real u1)
void applyJacobian_2(ROL::Vector< Real > &jv, const ROL::Vector< Real > &v, const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
Apply the partial constraint Jacobian at , , to the vector .
void apply_control_jacobian(std::vector< Real > &jv, const std::vector< Real > &v, const std::vector< Real > &u, const std::vector< Real > &z) const
void test_inverse_H1(std::ostream &outStream=std::cout)
const ROL::Vector< Real > & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
void apply_adjoint_control_jacobian(std::vector< Real > &jv, const std::vector< Real > &v, const std::vector< Real > &u, const std::vector< Real > &z) const
Real dot(const ROL::Vector< Real > &x) const
Compute where .
void apply_inverse_pde_jacobian(std::vector< Real > &ijv, const std::vector< Real > &v, const std::vector< Real > &u, const std::vector< Real > &z) const
L2VectorDual< Real > DualControlVector
ROL::Ptr< ROL::Vector< Real > > basis(const int i) const
Return i-th basis vector.
void applyAdjointHessian_22(ROL::Vector< Real > &ahwv, const ROL::Vector< Real > &w, const ROL::Vector< Real > &v, const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
Apply the optimization-space derivative of the adjoint of the constraint optimization-space Jacobian ...
void apply_H1(std::vector< Real > &Mu, const std::vector< Real > &u) const
void plus(const ROL::Vector< Real > &x)
Compute , where .
void apply_inverse_H1(std::vector< Real > &Mu, const std::vector< Real > &u) const
void apply_adjoint_pde_jacobian(std::vector< Real > &ajv, const std::vector< Real > &v, const std::vector< Real > &u, const std::vector< Real > &z) const
void set(const ROL::Vector< Real > &x)
Set where .
ROL::Ptr< ROL::Vector< Real > > clone() const
Clone to make a new (uninitialized) vector.
void apply_inverse_adjoint_pde_jacobian(std::vector< Real > &iajv, const std::vector< Real > &v, const std::vector< Real > &u, const std::vector< Real > &z) const
void apply_adjoint_control_pde_hessian(std::vector< Real > &ahwv, const std::vector< Real > &w, const std::vector< Real > &v, const std::vector< Real > &u, const std::vector< Real > &z)
void applyAdjointJacobian_2(ROL::Vector< Real > &jv, const ROL::Vector< Real > &v, const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
Apply the adjoint of the partial constraint Jacobian at , , to vector . This is the primary interface...
int dimension() const
Return dimension of the vector space.
Defines the constraint operator interface for simulation-based optimization.
ROL::Ptr< H1VectorPrimal< Real > > dual_vec_
const ROL::Vector< Real > & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
void value(ROL::Vector< Real > &c, const ROL::Vector< Real > &u, const ROL::Vector< Real > &z, Real &tol)
Evaluate the constraint operator at .
void set(const ROL::Vector< Real > &x)
Set where .
Real norm() const
Returns where .
void scale(std::vector< Real > &u, const Real alpha=0.0) const
const ROL::Vector< Real > & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
ROL::Ptr< H1VectorDual< Real > > dual_vec_
ROL::Ptr< std::vector< Real > > getVector()
void scale(const Real alpha)
Compute where .
int dimension() const
Return dimension of the vector space.
const ROL::Vector< Real > & dual() const
Return dual representation of , for example, the result of applying a Riesz map, or change of basis...
Real compute_L2_norm(const std::vector< Real > &r) const
ROL::Ptr< L2VectorPrimal< Real > > dual_vec_