ROL
ROL_PoissonInversion.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ************************************************************************
3 //
4 // Rapid Optimization Library (ROL) Package
5 // Copyright (2014) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact lead developers:
38 // Drew Kouri (dpkouri@sandia.gov) and
39 // Denis Ridzal (dridzal@sandia.gov)
40 //
41 // ************************************************************************
42 // @HEADER
43 
49 #ifndef USE_HESSVEC
50 #define USE_HESSVEC 1
51 #endif
52 
53 #ifndef ROL_POISSONINVERSION_HPP
54 #define ROL_POISSONINVERSION_HPP
55 
56 #include "ROL_StdVector.hpp"
57 #include "ROL_Objective.hpp"
58 #include "ROL_HelperFunctions.hpp"
59 
60 #include "Teuchos_LAPACK.hpp"
61 
62 namespace ROL {
63 namespace ZOO {
64 
67  template<class Real>
68  class Objective_PoissonInversion : public Objective<Real> {
69 
70  typedef std::vector<Real> vector;
71  typedef Vector<Real> V;
73 
74  typedef typename vector::size_type uint;
75 
76  private:
77  uint nu_;
78  uint nz_;
79 
80  Real hu_;
81  Real hz_;
82 
83  Real alpha_;
84 
85  Real eps_;
86  int reg_type_;
87 
88  Teuchos::RCP<const vector> getVector( const V& x ) {
89  using Teuchos::dyn_cast;
90  return dyn_cast<const SV>(x).getVector();
91  }
92 
93  Teuchos::RCP<vector> getVector( V& x ) {
94  using Teuchos::dyn_cast;
95  return dyn_cast<SV>(x).getVector();
96  }
97 
98 
99  public:
100 
101  /* CONSTRUCTOR */
102  Objective_PoissonInversion(uint nz = 32, Real alpha = 1.e-4) : nz_(nz), alpha_(alpha) {
103  nu_ = nz_-1;
104  hu_ = 1.0/((Real)nu_+1.0);
105  hz_ = hu_;
106  eps_ = 1.e-4;
107  reg_type_ = 2;
108  }
109 
110  /* REGULARIZATION DEFINITIONS */
111  Real reg_value(const Vector<Real> &z) {
112  using Teuchos::RCP;
113 
114  RCP<const vector> zp = getVector(z);
115 
116  Real val = 0.0;
117  for (uint i = 0; i < nz_; i++) {
118  if ( reg_type_ == 2 ) {
119  val += alpha_/2.0 * hz_ * (*zp)[i]*(*zp)[i];
120  }
121  else if ( reg_type_ == 1 ) {
122  val += alpha_ * hz_ * std::sqrt((*zp)[i]*(*zp)[i] + eps_);
123  }
124  else if ( reg_type_ == 0 ) {
125  if ( i < nz_-1 ) {
126  val += alpha_ * std::sqrt(std::pow((*zp)[i]-(*zp)[i+1],2.0)+eps_);
127  }
128  }
129  }
130  return val;
131  }
132 
134  using Teuchos::RCP;
135 
136  if ( reg_type_ == 2 ) {
137  g.set(z);
138  g.scale(alpha_*hz_);
139  }
140  else if ( reg_type_ == 1 ) {
141  RCP<const vector> zp = getVector(z);
142  RCP<vector > gp = getVector(g);
143 
144  for (uint i = 0; i < nz_; i++) {
145  (*gp)[i] = alpha_ * hz_ * (*zp)[i]/std::sqrt(std::pow((*zp)[i],2.0)+eps_);
146  }
147  }
148  else if ( reg_type_ == 0 ) {
149  RCP<const vector> zp = getVector(z);
150  RCP<vector> gp = getVector(g);
151 
152  Real diff = 0.0;
153  for (uint i = 0; i < nz_; i++) {
154  if ( i == 0 ) {
155  diff = (*zp)[i]-(*zp)[i+1];
156  (*gp)[i] = alpha_ * diff/std::sqrt(std::pow(diff,2.0)+eps_);
157  }
158  else if ( i == nz_-1 ) {
159  diff = (*zp)[i-1]-(*zp)[i];
160  (*gp)[i] = -alpha_ * diff/std::sqrt(std::pow(diff,2.0)+eps_);
161  }
162  else {
163  diff = (*zp)[i]-(*zp)[i+1];
164  (*gp)[i] = alpha_ * diff/std::sqrt(std::pow(diff,2.0)+eps_);
165  diff = (*zp)[i-1]-(*zp)[i];
166  (*gp)[i] -= alpha_ * diff/std::sqrt(std::pow(diff,2.0)+eps_);
167  }
168  }
169  }
170  }
171 
172  void reg_hessVec(Vector<Real> &hv, const Vector<Real> &v, const Vector<Real> &z) {
173 
174  using Teuchos::RCP;
175 
176  if ( reg_type_ == 2 ) {
177  hv.set(v);
178  hv.scale(alpha_*hz_);
179  }
180  else if ( reg_type_ == 1 ) {
181  RCP<const vector> zp = getVector(z);
182  RCP<const vector> vp = getVector(v);
183  RCP<vector> hvp = getVector(hv);
184 
185  for (uint i = 0; i < nz_; i++) {
186  (*hvp)[i] = alpha_*hz_*(*vp)[i]*eps_/std::pow(std::pow((*zp)[i],2.0)+eps_,3.0/2.0);
187  }
188  }
189  else if ( reg_type_ == 0 ) {
190  RCP<const vector> zp = getVector(z);
191  RCP<const vector> vp = getVector(v);
192  RCP<vector> hvp = getVector(hv);
193 
194  Real diff1 = 0.0;
195  Real diff2 = 0.0;
196  for (uint i = 0; i < nz_; i++) {
197  if ( i == 0 ) {
198  diff1 = (*zp)[i]-(*zp)[i+1];
199  diff1 = eps_/std::pow(std::pow(diff1,2.0)+eps_,3.0/2.0);
200  (*hvp)[i] = alpha_* ((*vp)[i]*diff1 - (*vp)[i+1]*diff1);
201  }
202  else if ( i == nz_-1 ) {
203  diff2 = (*zp)[i-1]-(*zp)[i];
204  diff2 = eps_/std::pow(std::pow(diff2,2.0)+eps_,3.0/2.0);
205  (*hvp)[i] = alpha_* (-(*vp)[i-1]*diff2 + (*vp)[i]*diff2);
206  }
207  else {
208  diff1 = (*zp)[i]-(*zp)[i+1];
209  diff1 = eps_/std::pow(std::pow(diff1,2.0)+eps_,3.0/2.0);
210  diff2 = (*zp)[i-1]-(*zp)[i];
211  diff2 = eps_/std::pow(std::pow(diff2,2.0)+eps_,3.0/2.0);
212  (*hvp)[i] = alpha_* (-(*vp)[i-1]*diff2 + (*vp)[i]*(diff1 + diff2) - (*vp)[i+1]*diff1);
213  }
214  }
215  }
216  }
217 
218  /* FINITE ELEMENT DEFINTIONS */
219  void apply_mass(Vector<Real> &Mf, const Vector<Real> &f ) {
220 
221  using Teuchos::RCP;
222  RCP<const vector> fp = getVector(f);
223  RCP<vector> Mfp = getVector(Mf);
224 
225  for (uint i = 0; i < nu_; i++) {
226  if ( i == 0 ) {
227  (*Mfp)[i] = hu_/6.0*(4.0*(*fp)[i] + (*fp)[i+1]);
228  }
229  else if ( i == nu_-1 ) {
230  (*Mfp)[i] = hu_/6.0*((*fp)[i-1] + 4.0*(*fp)[i]);
231  }
232  else {
233  (*Mfp)[i] = hu_/6.0*((*fp)[i-1] + 4.0*(*fp)[i] + (*fp)[i+1]);
234  }
235  }
236  }
237 
239 
240  using Teuchos::RCP;
241  RCP<const vector> zp = getVector(z);
242  RCP<vector> up = getVector(u);
243  RCP<vector> bp = getVector(b);
244 
245  // Get Diagonal and Off-Diagonal Entries of PDE Jacobian
246  vector d(nu_,1.0);
247  vector o(nu_-1,1.0);
248  for ( uint i = 0; i < nu_; i++ ) {
249  d[i] = (std::exp((*zp)[i]) + std::exp((*zp)[i+1]))/hu_;
250  if ( i < nu_-1 ) {
251  o[i] *= -std::exp((*zp)[i+1])/hu_;
252  }
253  }
254 
255  // Solve Tridiagonal System Using LAPACK's SPD Tridiagonal Solver
256  Teuchos::LAPACK<int,Real> lp;
257  int info;
258  int ldb = nu_;
259  int nhrs = 1;
260  lp.PTTRF(nu_,&d[0],&o[0],&info);
261  lp.PTTRS(nu_,nhrs,&d[0],&o[0],&(*bp)[0],ldb,&info);
262  u.set(b);
263  }
264 
265  Real evaluate_target(Real x) {
266  return x*(1.0-x);
267  }
268 
270  const Vector<Real> &d, const Vector<Real> &u ) {
271 
272  using Teuchos::RCP;
273 
274  RCP<const vector> zp = getVector(z);
275  RCP<const vector> up = getVector(u);
276  RCP<const vector> dp = getVector(d);
277  RCP<vector> Bdp = getVector(Bd);
278 
279  for (uint i = 0; i < nu_; i++) {
280  if ( i == 0 ) {
281  (*Bdp)[i] = 1.0/hu_*( std::exp((*zp)[i])*(*up)[i]*(*dp)[i]
282  + std::exp((*zp)[i+1])*((*up)[i]-(*up)[i+1])*(*dp)[i+1] );
283  }
284  else if ( i == nu_-1 ) {
285  (*Bdp)[i] = 1.0/hu_*( std::exp((*zp)[i])*((*up)[i]-(*up)[i-1])*(*dp)[i]
286  + std::exp((*zp)[i+1])*(*up)[i]*(*dp)[i+1] );
287  }
288  else {
289  (*Bdp)[i] = 1.0/hu_*( std::exp((*zp)[i])*((*up)[i]-(*up)[i-1])*(*dp)[i]
290  + std::exp((*zp)[i+1])*((*up)[i]-(*up)[i+1])*(*dp)[i+1] );
291  }
292  }
293  }
294 
296  const Vector<Real> &d, const Vector<Real> &u ) {
297  using Teuchos::RCP;
298 
299  RCP<const vector> zp = getVector(z);
300  RCP<const vector> up = getVector(u);
301  RCP<const vector> dp = getVector(d);
302  RCP<vector> Bdp = getVector(Bd);
303 
304  for (uint i = 0; i < nz_; i++) {
305  if ( i == 0 ) {
306  (*Bdp)[i] = std::exp((*zp)[i])/hu_*(*up)[i]*(*dp)[i];
307  }
308  else if ( i == nz_-1 ) {
309  (*Bdp)[i] = std::exp((*zp)[i])/hu_*(*up)[i-1]*(*dp)[i-1];
310  }
311  else {
312  (*Bdp)[i] = std::exp((*zp)[i])/hu_*( ((*up)[i]-(*up)[i-1])*((*dp)[i]-(*dp)[i-1]) );
313  }
314  }
315  }
316 
318  const Vector<Real> &d, const Vector<Real> &u ) {
319  using Teuchos::RCP;
320  RCP<const vector> zp = getVector(z);
321  RCP<const vector> vp = getVector(v);
322  RCP<const vector> up = getVector(u);
323  RCP<const vector> dp = getVector(d);
324  RCP<vector> Bdp = getVector(Bd);
325 
326  for (uint i = 0; i < nz_; i++) {
327  if ( i == 0 ) {
328  (*Bdp)[i] = (*vp)[i]*std::exp((*zp)[i])/hu_*(*up)[i]*(*dp)[i];
329  }
330  else if ( i == nz_-1 ) {
331  (*Bdp)[i] = (*vp)[i]*std::exp((*zp)[i])/hu_*(*up)[i-1]*(*dp)[i-1];
332  }
333  else {
334  (*Bdp)[i] = (*vp)[i]*std::exp((*zp)[i])/hu_*( ((*up)[i]-(*up)[i-1])*((*dp)[i]-(*dp)[i-1]) );
335  }
336  }
337  }
338 
339  /* STATE AND ADJOINT EQUATION DEFINTIONS */
341 
342  using Teuchos::RCP;
343  using Teuchos::rcp;
344 
345  Real k1 = 1.0;
346  Real k2 = 2.0;
347  // Right Hand Side
348  RCP<vector> bp = rcp( new vector(nu_, 0.0) );
349  for ( uint i = 0; i < nu_; i++ ) {
350  if ( (Real)(i+1)*hu_ < 0.5 ) {
351  (*bp)[i] = 2.0*k1*hu_;
352  }
353  else if ( std::abs((Real)(i+1)*hu_ - 0.5) < ROL_EPSILON ) {
354  (*bp)[i] = (k1+k2)*hu_;
355  }
356  else if ( (Real)(i+1)*hu_ > 0.5 ) {
357  (*bp)[i] = 2.0*k2*hu_;
358  }
359  }
360 
361  SV b(bp);
362  // Solve Equation
363  solve_poisson(u,z,b);
364  }
365 
367 
368  using Teuchos::RCP;
369  using Teuchos::rcp;
370 
371  RCP<const vector> up = getVector(u);
372  RCP<vector> rp = rcp( new vector(nu_,0.0) );
373  SV res(rp);
374 
375  for ( uint i = 0; i < nu_; i++) {
376  (*rp)[i] = -((*up)[i]-evaluate_target((Real)(i+1)*hu_));
377  }
378  StdVector<Real> Mres( Teuchos::rcp( new std::vector<Real>(nu_,0.0) ) );
379  apply_mass(Mres,res);
380  solve_poisson(p,z,Mres);
381  }
382 
384  const Vector<Real> &u, const Vector<Real> &z) {
385  using Teuchos::rcp;
386  SV b( rcp( new vector(nu_,0.0) ) );
388  solve_poisson(w,z,b);
389  }
390 
392  const Vector<Real> &p, const Vector<Real> &u, const Vector<Real> &z) {
393 
394  using Teuchos::rcp;
395 
396  SV res( rcp( new vector(nu_,0.0) ) );
397  apply_mass(res,w);
398  SV res1( rcp( new vector(nu_,0.0) ) );
400  res.axpy(-1.0,res1);
401  solve_poisson(q,z,res);
402  }
403 
404  /* OBJECTIVE FUNCTION DEFINITIONS */
405  Real value( const Vector<Real> &z, Real &tol ) {
406 
407  using Teuchos::RCP;
408  using Teuchos::rcp;
409 
410  // SOLVE STATE EQUATION
411  RCP<vector> up = rcp( new vector(nu_,0.0) );
412  SV u( up );
413 
415 
416  // COMPUTE MISFIT
417  RCP<vector> rp = rcp( new vector(nu_,0.0) );
418  SV res( rp );
419 
420  for ( uint i = 0; i < nu_; i++) {
421  (*rp)[i] = ((*up)[i]-evaluate_target((Real)(i+1)*hu_));
422  }
423 
424  RCP<V> Mres = res.clone();
425  apply_mass(*Mres,res);
426  return 0.5*Mres->dot(res) + reg_value(z);
427  }
428 
429  void gradient( Vector<Real> &g, const Vector<Real> &z, Real &tol ) {
430 
431  using Teuchos::rcp;
432 
433  // SOLVE STATE EQUATION
434  SV u( rcp( new vector(nu_,0.0) ) );
436 
437  // SOLVE ADJOINT EQUATION
438  SV p( Teuchos::rcp( new std::vector<Real>(nu_,0.0) ) );
439  solve_adjoint_equation(p,u,z);
440 
441  // Apply Transpose of Linearized Control Operator
443 
444  // Regularization gradient
445  SV g_reg( rcp( new vector(nz_,0.0) ) );
446  reg_gradient(g_reg,z);
447 
448  // Build Gradient
449  g.plus(g_reg);
450  }
451 #if USE_HESSVEC
452  void hessVec( Vector<Real> &hv, const Vector<Real> &v, const Vector<Real> &z, Real &tol ) {
453 
454  using Teuchos::rcp;
455 
456  // SOLVE STATE EQUATION
457  SV u( rcp( new vector(nu_,0.0) ) );
459 
460  // SOLVE ADJOINT EQUATION
461  SV p( rcp( new vector(nu_,0.0) ) );
462  solve_adjoint_equation(p,u,z);
463 
464  // SOLVE STATE SENSITIVITY EQUATION
465  SV w( rcp( new vector(nu_,0.0) ) );
467 
468  // SOLVE ADJOINT SENSITIVITY EQUATION
469  SV q( rcp( new vector(nu_,0.0) ) );
471 
472  // Apply Transpose of Linearized Control Operator
474 
475  // Apply Transpose of Linearized Control Operator
476  SV tmp( rcp( new vector(nz_,0.0) ) );
478  hv.axpy(-1.0,tmp);
479 
480  // Apply Transpose of 2nd Derivative of Control Operator
481  tmp.zero();
483  hv.plus(tmp);
484 
485  // Regularization hessVec
486  SV hv_reg( rcp( new vector(nz_,0.0) ) );
487  reg_hessVec(hv_reg,v,z);
488 
489  // Build hessVec
490  hv.plus(hv_reg);
491  }
492 #endif
493 
494  void invHessVec( Vector<Real> &hv, const Vector<Real> &v, const Vector<Real> &x, Real &tol ) {
495 
496  using Teuchos::RCP;
497  using Teuchos::rcp;
498 
499  // Cast hv and v vectors to std::vector.
500  RCP<vector> hvp = getVector(hv);
501 
502  std::vector<Real> vp(*getVector(v));
503 
504  int dim = static_cast<int>(vp.size());
505 
506 
507  // Compute dense Hessian.
508  Teuchos::SerialDenseMatrix<int, Real> H(dim, dim);
509  Objective_PoissonInversion<Real> & obj = *this;
510  H = computeDenseHessian<Real>(obj, x);
511 
512  // Compute eigenvalues, sort real part.
513  std::vector<vector> eigenvals = computeEigenvalues<Real>(H);
514  std::sort((eigenvals[0]).begin(), (eigenvals[0]).end());
515 
516  // Perform 'inertia' correction.
517  Real inertia = (eigenvals[0])[0];
518  Real correction = 0.0;
519  if ( inertia <= 0.0 ) {
520  correction = 2.0*std::abs(inertia);
521  if ( inertia == 0.0 ) {
522  int cnt = 0;
523  while ( eigenvals[0][cnt] == 0.0 ) {
524  cnt++;
525  }
526  correction = 0.5*eigenvals[0][cnt];
527  if ( cnt == dim-1 ) {
528  correction = 1.0;
529  }
530  }
531  for (int i=0; i<dim; i++) {
532  H(i,i) += correction;
533  }
534  }
535 
536  // Compute dense inverse Hessian.
537  Teuchos::SerialDenseMatrix<int, Real> invH = computeInverse<Real>(H);
538 
539  // Apply dense inverse Hessian.
540  Teuchos::SerialDenseVector<int, Real> hv_teuchos(Teuchos::View, &((*hvp)[0]), dim);
541  const Teuchos::SerialDenseVector<int, Real> v_teuchos(Teuchos::View, &(vp[0]), dim);
542  hv_teuchos.multiply(Teuchos::NO_TRANS, Teuchos::NO_TRANS, 1.0, invH, v_teuchos, 0.0);
543  }
544 
545  };
546 
547  template<class Real>
548  void getPoissonInversion( Teuchos::RCP<Objective<Real> > &obj, Vector<Real> &x0, Vector<Real> &x ) {
549 
550  typedef std::vector<Real> vector;
551  typedef StdVector<Real> SV;
552 
553  typedef typename vector::size_type uint;
554 
555  using Teuchos::RCP;
556  using Teuchos::rcp;
557  using Teuchos::dyn_cast;
558 
559  // Cast Initial Guess and Solution Vectors
560  RCP<vector> x0p = dyn_cast<SV>(x0).getVector();
561  RCP<vector> xp = dyn_cast<SV>(x).getVector();
562 
563  uint n = xp->size();
564  // Resize Vectors
565  n = 128;
566  x0p->resize(n);
567  xp->resize(n);
568  // Instantiate Objective Function
569  obj = rcp( new Objective_PoissonInversion<Real>(n,1.e-6) );
570  // Get Initial Guess
571  for (uint i=0; i<n; i++) {
572  (*x0p)[i] = 1.5;
573  }
574  // Get Solution
575  Real h = 1.0/((Real)n+1);
576  Real pt = 0.0;
577  Real k1 = 1.0;
578  Real k2 = 2.0;
579  for( uint i=0; i<n; i++ ) {
580  pt = (Real)(i+1)*h;
581  if ( pt >= 0.0 && pt < 0.5 ) {
582  (*xp)[i] = std::log(k1);
583  }
584  else if ( pt >= 0.5 && pt < 1.0 ) {
585  (*xp)[i] = std::log(k2);
586  }
587  }
588  }
589 
590 } // End ZOO Namespace
591 } // End ROL Namespace
592 
593 #endif
Provides the interface to evaluate objective functions.
void apply_transposed_linearized_control_operator(Vector< Real > &Bd, const Vector< Real > &z, const Vector< Real > &d, const Vector< Real > &u)
virtual void scale(const Real alpha)=0
Compute where .
void getPoissonInversion(Teuchos::RCP< Objective< Real > > &obj, Vector< Real > &x0, Vector< Real > &x)
void axpy(const Real alpha, const Vector< Real > &x)
Compute where .
void solve_state_sensitivity_equation(Vector< Real > &w, const Vector< Real > &v, const Vector< Real > &u, const Vector< Real > &z)
virtual void plus(const Vector &x)=0
Compute , where .
virtual void axpy(const Real alpha, const Vector &x)
Compute where .
Definition: ROL_Vector.hpp:143
void gradient(Vector< Real > &g, const Vector< Real > &z, Real &tol)
Compute gradient.
virtual void hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply Hessian approximation to vector.
virtual void zero()
Set to zero vector.
Definition: ROL_Vector.hpp:157
Contains definitions for helper functions in ROL.
Defines the linear algebra or vector space interface.
Definition: ROL_Vector.hpp:74
void solve_poisson(Vector< Real > &u, const Vector< Real > &z, Vector< Real > &b)
Teuchos::RCP< Vector< Real > > clone() const
Clone to make a new (uninitialized) vector.
void solve_adjoint_sensitivity_equation(Vector< Real > &q, const Vector< Real > &w, const Vector< Real > &v, const Vector< Real > &p, const Vector< Real > &u, const Vector< Real > &z)
void apply_transposed_linearized_control_operator_2(Vector< Real > &Bd, const Vector< Real > &z, const Vector< Real > &v, const Vector< Real > &d, const Vector< Real > &u)
Provides the std::vector implementation of the ROL::Vector interface.
void invHessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &x, Real &tol)
Apply inverse Hessian approximation to vector.
void solve_state_equation(Vector< Real > &u, const Vector< Real > &z)
void reg_hessVec(Vector< Real > &hv, const Vector< Real > &v, const Vector< Real > &z)
void apply_mass(Vector< Real > &Mf, const Vector< Real > &f)
void solve_adjoint_equation(Vector< Real > &p, const Vector< Real > &u, const Vector< Real > &z)
Teuchos::RCP< const vector > getVector(const V &x)
void apply_linearized_control_operator(Vector< Real > &Bd, const Vector< Real > &z, const Vector< Real > &d, const Vector< Real > &u)
Real value(const Vector< Real > &z, Real &tol)
Compute value.
Objective_PoissonInversion(uint nz=32, Real alpha=1.e-4)
virtual void set(const Vector &x)
Set where .
Definition: ROL_Vector.hpp:196
Real reg_value(const Vector< Real > &z)
void reg_gradient(Vector< Real > &g, const Vector< Real > &z)
Teuchos::RCP< vector > getVector(V &x)
static const double ROL_EPSILON
Platform-dependent machine epsilon.
Definition: ROL_Types.hpp:118