LCOV - code coverage report
Current view: top level - functionals - L2NormPow2.h (source / functions) Hit Total Coverage
Test: test_coverage.info.cleaned Lines: 1 1 100.0 %
Date: 2022-08-04 03:43:28 Functions: 2 8 25.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "Functional.h"
       4             : #include "DataContainer.h"
       5             : #include "LinearOperator.h"
       6             : 
       7             : namespace elsa
       8             : {
       9             :     /**
      10             :      * @brief Class representing the l2 norm functional (squared).
      11             :      *
      12             :      * The l2 norm (squared) functional evaluates to \f$ 0.5 * \sum_{i=1}^n x_i^2 \f$ for \f$
      13             :      * x=(x_i)_{i=1}^n \f$.
      14             : 
      15             :      * @author - Matthias Wieczorek - initial code
      16             :      * - Maximilian Hornung - modularization
      17             :      * - Tobias Lasser - modernization
      18             :      *
      19             :      * @tparam data_t data type for the domain of the residual of the functional, defaulting to
      20             :      * real_t
      21             :      */
      22             :     template <typename data_t = real_t>
      23             :     class L2NormPow2 : public Functional<data_t>
      24             :     {
      25             :     public:
      26             :         /**
      27             :          * @brief Constructor for the l2 norm (squared) functional, mapping domain vector to a
      28             :          * scalar (without a residual)
      29             :          *
      30             :          * @param[in] domainDescriptor describing the domain of the functional
      31             :          */
      32             :         explicit L2NormPow2(const DataDescriptor& domainDescriptor);
      33             : 
      34             :         /**
      35             :          * @brief Constructor for the l2 norm (squared) functional, using a residual as input to map
      36             :          * to a scalar
      37             :          *
      38             :          * @param[in] residual to be used when evaluating the functional (or its derivatives)
      39             :          */
      40             :         explicit L2NormPow2(const Residual<data_t>& residual);
      41             : 
      42             :         /**
      43             :          * @brief Constructor the l2 norm (squared) functional with a LinearResidual
      44             :          *
      45             :          * @param[in] A LinearOperator to use in the residual
      46             :          * @param[in] b data to use in the linear residual
      47             :          */
      48             :         L2NormPow2(const LinearOperator<data_t>& A, const DataContainer<data_t>& b);
      49             : 
      50             :         /// make copy constructor deletion explicit
      51             :         L2NormPow2(const L2NormPow2<data_t>&) = delete;
      52             : 
      53             :         /// default destructor
      54          27 :         ~L2NormPow2() override = default;
      55             : 
      56             :     protected:
      57             :         /// the evaluation of the l2 norm (squared)
      58             :         data_t evaluateImpl(const DataContainer<data_t>& Rx) override;
      59             : 
      60             :         /// the computation of the gradient (in place)
      61             :         void getGradientInPlaceImpl(DataContainer<data_t>& Rx) override;
      62             : 
      63             :         /// the computation of the Hessian
      64             :         LinearOperator<data_t> getHessianImpl(const DataContainer<data_t>& Rx) override;
      65             : 
      66             :         /// implement the polymorphic clone operation
      67             :         L2NormPow2<data_t>* cloneImpl() const override;
      68             : 
      69             :         /// implement the polymorphic comparison operation
      70             :         bool isEqual(const Functional<data_t>& other) const override;
      71             :     };
      72             : 
      73             : } // namespace elsa

Generated by: LCOV version 1.14