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

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "DataContainer.h"
       4             : #include "elsaDefines.h"
       5             : 
       6             : namespace elsa
       7             : {
       8             :     /**
       9             :      * The Proximal operator of the Huber functional. The proximal is defined
      10             :      * as
      11             :      * \[
      12             :      * prox_{sigma H}(v) = (1 - (\frac{\sigma}{\max \{ || v ||_2, \sigma\}}))v
      13             :      * \]
      14             :      *
      15             :      * @see Huber
      16             :      */
      17             :     template <typename data_t = real_t>
      18             :     class ProximalHuber
      19             :     {
      20             :     public:
      21             :         ProximalHuber() = default;
      22             : 
      23             :         ProximalHuber(data_t delta);
      24             : 
      25             :         ~ProximalHuber() = default;
      26             : 
      27             :         /**
      28             :          * @brief apply the proximal operator of the l1 norm to an element in the operator's domain
      29             :          *
      30             :          * @param[in] v input DataContainer
      31             :          * @param[in] t input Threshold
      32             :          * @param[out] prox output DataContainer
      33             :          */
      34             :         void apply(const DataContainer<data_t>& v, SelfType_t<data_t> t,
      35             :                    DataContainer<data_t>& prox) const;
      36             : 
      37             :         DataContainer<data_t> apply(const DataContainer<data_t>& v, SelfType_t<data_t> t) const;
      38             : 
      39           0 :         data_t delta() const { return delta_; }
      40             : 
      41             :     private:
      42             :         data_t delta_{0.0001};
      43             :     };
      44             : 
      45             :     template <typename T>
      46             :     bool operator==(const ProximalHuber<T>& lhs, const ProximalHuber<T>& rhs)
      47             :     {
      48             :         return lhs.delta() == rhs.delta();
      49             :     }
      50             : 
      51             :     template <typename T>
      52             :     bool operator!=(const ProximalHuber<T>& lhs, const ProximalHuber<T>& rhs)
      53             :     {
      54             :         return !(lhs == rhs);
      55             :     }
      56             : } // namespace elsa

Generated by: LCOV version 1.14