PISM, A Parallel Ice Sheet Model  stable v2.1-1-g6902d5502 committed by Ed Bueler on 2023-12-20 08:38:27 -0800
IPLogRatioFunctional.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 IPLOGRATIOFUNCTIONAL_HH_HSEWI0Q8
20 #define IPLOGRATIOFUNCTIONAL_HH_HSEWI0Q8
21 
22 #include "pism/inverse/functional/IPFunctional.hh"
23 
24 namespace pism {
25 namespace inverse {
26 
27 //! Implements a functional for log-ratio errors.
28 /*! This type of functional appears in [\ref Morlighemetal2010].
29  Specifically, given a reference function \f$u_{obs}=[U_i]\f$, and an
30  array::Vector \f$x=[X_i]\f$,
31  \f[
32  J(x) = c_N \sum_i W_i\left[\log\left(\frac{|X_i+U_i|^2+\epsilon^2}{|U_{i}|^2+\epsilon^2}\right)\right]^2
33  \f]
34  where \f$\epsilon\f$ is a regularizing constant and \f$[W_i]\f$ is a vector of weights.
35  The term \f$X_i+U_i\f$ appears because the argument is expected to already be in the form
36  \f$V_i-U_i\f$, where \f$v=[V_i]\f$ is some approximation of \f$[U_i]\f$ and hence the
37  integrand has the form \f$\log(|V_i|/|U_i|)\f$.
38 
39  The normalization constant \f$c_N\f$ is determined implicitly by normalize().
40 */
41 class IPLogRatioFunctional : public IPFunctional<array::Vector> {
42 public:
43  IPLogRatioFunctional(std::shared_ptr<const Grid> grid, array::Vector &u_observed, double eps,
44  array::Scalar *weights=NULL) :
45  IPFunctional<array::Vector>(grid), m_u_observed(u_observed), m_weights(weights),
46  m_normalization(1.), m_eps(eps) {};
47  virtual ~IPLogRatioFunctional() {};
48 
49  virtual void normalize(double scale);
50 
51  virtual void valueAt(array::Vector &x, double *OUTPUT);
52  virtual void gradientAt(array::Vector &x, array::Vector &gradient);
53 
54 protected:
58  double m_eps;
59 
60 };
61 
62 } // end of namespace inverse
63 } // end of namespace pism
64 
65 #endif /* end of include guard: IPLOGRATIOFUNCTIONAL_HH_HSEWI0Q8 */
Abstract base class for functions from ice model vectors to .
Definition: IPFunctional.hh:41
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.
IPLogRatioFunctional(std::shared_ptr< const Grid > grid, array::Vector &u_observed, double eps, array::Scalar *weights=NULL)
virtual void gradientAt(array::Vector &x, array::Vector &gradient)
Computes the gradient of the functional at the vector x.
Implements a functional for log-ratio errors.