LCOV - code coverage report
Current view: top level - problems - RegularizationTerm.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             : #include <memory>
       6             : 
       7             : namespace elsa
       8             : {
       9             :     /**
      10             :      * @brief Class representing a regularization term (a scalar parameter and a functional).
      11             :      *
      12             :      * @author Maximilian Hornung - initial code
      13             :      * @author Tobias Lasser - modernization
      14             :      *
      15             :      * @tparam data_t data type for the domain and range of the problem, defaulting to real_t
      16             :      *
      17             :      * This class represents a regularization term, consisting of a regularization parameter (a
      18             :      * scalar) and a term (represented as a Functional). It is just a light-weight wrapper with no
      19             :      * added functionality.
      20             :      */
      21             :     template <typename data_t = real_t>
      22             :     class RegularizationTerm
      23             :     {
      24             :     public:
      25             :         /**
      26             :          * @brief Constructor for the regularization term, accepting a weight and a functional.
      27             :          *
      28             :          * @param weight the regularization parameter
      29             :          * @param functional the actual term
      30             :          */
      31             :         RegularizationTerm(data_t weight, const Functional<data_t>& functional);
      32             : 
      33             :         /// copy constructor
      34             :         RegularizationTerm(const RegularizationTerm<data_t>& other);
      35             : 
      36             :         /// copy assignment
      37             :         RegularizationTerm<data_t>& operator=(const RegularizationTerm<data_t>& other);
      38             : 
      39             :         /// move constructor
      40             :         RegularizationTerm(RegularizationTerm<data_t>&& other) noexcept;
      41             : 
      42             :         /// move assignment
      43             :         RegularizationTerm<data_t>& operator=(RegularizationTerm<data_t>&& other) noexcept;
      44             : 
      45             :         /// the default destructor
      46           0 :         ~RegularizationTerm() = default;
      47             : 
      48             :         /// return the weight of the regularization term (the regularization parameter)
      49             :         data_t getWeight() const;
      50             : 
      51             :         /// return the functional of the regularization term
      52             :         Functional<data_t>& getFunctional() const;
      53             : 
      54             :         /// comparison operator
      55             :         bool operator==(const RegularizationTerm<data_t>& other) const;
      56             : 
      57             :         /// negative comparison operator
      58             :         bool operator!=(const RegularizationTerm<data_t>& other) const;
      59             : 
      60             :     private:
      61             :         /// the weight / regularization parameter
      62             :         data_t _weight;
      63             : 
      64             :         /// the functional of the regularization term
      65             :         std::unique_ptr<Functional<data_t>> _functional;
      66             :     };
      67             : } // namespace elsa

Generated by: LCOV version 1.14