LCOV - code coverage report
Current view: top level - elsa/functionals - WeightedL1Norm.h (source / functions) Hit Total Coverage
Test: coverage-all.lcov Lines: 1 1 100.0 %
Date: 2024-05-16 04:22:26 Functions: 2 2 100.0 %

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

Generated by: LCOV version 1.14