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

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

Generated by: LCOV version 1.14