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

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "DataContainer.h"
       4             : #include "Functional.h"
       5             : #include "LinearOperator.h"
       6             : 
       7             : namespace elsa
       8             : {
       9             :     /**
      10             :      * @brief Class representing the l0 pseudo-norm functional.
      11             :      *
      12             :      * The l0 pseudo-norm functional evaluates to @f$ \sum_{i=1}^n 1_{x_{i} \neq 0} @f$ for @f$
      13             :      * x=(x_i)_{i=1}^n @f$. Please note that it is not differentiable, hence getGradient and
      14             :      * getHessian will throw exceptions.
      15             :      *
      16             :      * References:
      17             :      * * https://www.sciencedirect.com/bookseries/north-holland-mathematical-library/vol/38/suppl/C
      18             :      * * https://en.wikipedia.org/wiki/Lp_space#When_p_=_0
      19             :      *
      20             :      * @tparam data_t data type for the domain of the residual of the functional, defaulting to
      21             :      * real_t
      22             :      *
      23             :      * @author Andi Braimllari - initial code
      24             :      */
      25             :     template <typename data_t = real_t>
      26             :     class L0PseudoNorm : public Functional<data_t>
      27             :     {
      28             :     public:
      29             :         /**
      30             :          * @brief Constructor for the l0 pseudo-norm functional, mapping domain vector to a scalar
      31             :          * (without a residual)
      32             :          *
      33             :          * @param[in] domainDescriptor describing the domain of the functional
      34             :          */
      35             :         explicit L0PseudoNorm(const DataDescriptor& domainDescriptor);
      36             : 
      37             :         /// make copy constructor deletion explicit
      38             :         L0PseudoNorm(const L0PseudoNorm<data_t>&) = delete;
      39             : 
      40             :         /// default destructor
      41           8 :         ~L0PseudoNorm() override = default;
      42             : 
      43             :     protected:
      44             :         /// the evaluation of the l0 pseudo-norm
      45             :         data_t evaluateImpl(const DataContainer<data_t>& Rx) const override;
      46             : 
      47             :         /// the computation of the gradient (in place)
      48             :         void getGradientImpl(const DataContainer<data_t>& Rx,
      49             :                              DataContainer<data_t>&) const override;
      50             : 
      51             :         /// the computation of the Hessian
      52             :         LinearOperator<data_t> getHessianImpl(const DataContainer<data_t>& Rx) const override;
      53             : 
      54             :         /// implement the polymorphic clone operation
      55             :         auto cloneImpl() const -> L0PseudoNorm<data_t>* override;
      56             : 
      57             :         /// implement the polymorphic comparison operation
      58             :         auto isEqual(const Functional<data_t>& other) const -> bool override;
      59             :     };
      60             : } // namespace elsa

Generated by: LCOV version 1.14