PISM, A Parallel Ice Sheet Model  stable v2.1-1-g6902d5502 committed by Ed Bueler on 2023-12-20 08:38:27 -0800
IPLogRelativeFunctional.hh
Go to the documentation of this file.
1 // Copyright (C) 2013, 2014, 2015, 2022 David Maxwell and Constantine Khroulev
2 //
3 // This file is part of PISM.
4 //
5 // PISM is free software; you can redistribute it and/or modify it under the
6 // terms of the GNU General Public License as published by the Free Software
7 // Foundation; either version 3 of the License, or (at your option) any later
8 // version.
9 //
10 // PISM is distributed in the hope that it will be useful, but WITHOUT ANY
11 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with PISM; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 
19 #ifndef IPLOGRELATIVEFUNCTIONAL_HH_97I6BWHG
20 #define IPLOGRELATIVEFUNCTIONAL_HH_97I6BWHG
21 
22 #include "pism/inverse/functional/IPFunctional.hh"
23 
24 namespace pism {
25 namespace inverse {
26 
27 //! Implements a functional for log-relative errors.
28 /*! Specifically, given a reference function \f$u_{obs}=[U_i]\f$,
29  \f[
30  J(x) = c_N \sum_i \log\left(1+W_i\frac{|X_i|^2}{|U_{i}|^2+\epsilon^2}\right)
31  \f]
32  where \f$\epsilon={\tt inv_ssa_velocity_eps}\f$ and \f$w\f$ is an optionally
33  provided weight function. The normalization constant \f$c_N\f$ is determined
34  implicitly by normalize().
35 */
36 class IPLogRelativeFunctional : public IPFunctional<array::Vector> {
37 public:
38  IPLogRelativeFunctional(std::shared_ptr<const Grid> grid, array::Vector &u_observed, double eps,
39  array::Scalar *weights=NULL) :
40  IPFunctional<array::Vector>(grid), m_u_observed(u_observed), m_weights(weights), m_normalization(1.), m_eps(eps) {};
42 
43  virtual void normalize(double scale);
44 
45  virtual void valueAt(array::Vector &x, double *OUTPUT);
46  virtual void gradientAt(array::Vector &x, array::Vector &gradient);
47 
48 protected:
52  double m_eps;
53 };
54 
55 
56 } // end of namespace inverse
57 } // end of namespace pism
58 
59 #endif /* end of include guard: IPLOGRELATIVEFUNCTIONAL_HH_97I6BWHG */
Abstract base class for functions from ice model vectors to .
Definition: IPFunctional.hh:41
IPLogRelativeFunctional(std::shared_ptr< const Grid > grid, array::Vector &u_observed, double eps, array::Scalar *weights=NULL)
virtual void normalize(double scale)
Determine the normalization constant for the functional.
virtual void valueAt(array::Vector &x, double *OUTPUT)
Computes the value of the functional at the vector x.
virtual void gradientAt(array::Vector &x, array::Vector &gradient)
Computes the gradient of the functional at the vector x.
Implements a functional for log-relative errors.