LCOV - code coverage report
Current view: top level - elsa/proximal_operators - ProximalL2Squared.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 <optional>
       4             : 
       5             : #include "DataContainer.h"
       6             : #include "StrongTypes.h"
       7             : #include "elsaDefines.h"
       8             : 
       9             : namespace elsa
      10             : {
      11             :     /**
      12             :      * @brief Proximal operator for the functional \f$f(x) = \lambda || x - b ||_2^2\f$, where
      13             :      * \f$b\f$ is potentially zero.
      14             :      *
      15             :      * The proximal is given as:
      16             :      * @f[
      17             :      * \mathrm{prox}_{\sigma f}(x) = \frac{x + 2 \sigma \lambda b}{1 + 2 \sigma \lambda}
      18             :      * @f]
      19             :      * This follows the proximal definition of other frameworks such as ODL
      20             :      * or the Core Imaging Library (CIL).
      21             :      */
      22             :     template <class data_t>
      23             :     class ProximalL2Squared
      24             :     {
      25             :     public:
      26          12 :         ProximalL2Squared() = default;
      27             : 
      28             :         explicit ProximalL2Squared(data_t sigma);
      29             : 
      30             :         explicit ProximalL2Squared(const DataContainer<data_t>& b);
      31             : 
      32             :         ProximalL2Squared(const DataContainer<data_t>& b, SelfType_t<data_t> sigma);
      33             : 
      34             :         DataContainer<data_t> apply(const DataContainer<data_t>& v, SelfType_t<data_t> t) const;
      35             : 
      36             :         void apply(const DataContainer<data_t>& v, SelfType_t<data_t> t,
      37             :                    DataContainer<data_t>& prox) const;
      38             : 
      39             :     private:
      40             :         data_t sigma_{1};
      41             : 
      42             :         std::optional<DataContainer<data_t>> b_ = {};
      43             :     };
      44             : } // namespace elsa

Generated by: LCOV version 1.14