URI:
       tIPLogRatioFunctional.hh - pism - [fork] customized build of PISM, the parallel ice sheet model (tillflux branch)
  HTML git clone git://src.adamsgaard.dk/pism
   DIR Log
   DIR Files
   DIR Refs
   DIR LICENSE
       ---
       tIPLogRatioFunctional.hh (2487B)
       ---
            1 // Copyright (C) 2013, 2014, 2015  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 "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   IceModelVec2V \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<IceModelVec2V> {
           42 public:
           43   IPLogRatioFunctional(IceGrid::ConstPtr grid, IceModelVec2V &u_observed, double eps,
           44                        IceModelVec2S *weights=NULL) :
           45     IPFunctional<IceModelVec2V>(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(IceModelVec2V &x, double *OUTPUT);
           52   virtual void gradientAt(IceModelVec2V &x, IceModelVec2V &gradient);
           53 
           54 protected:
           55   IceModelVec2V &m_u_observed;
           56   IceModelVec2S *m_weights;
           57   double m_normalization;
           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 */