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

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

Generated by: LCOV version 1.14