LCOV - code coverage report
Current view: top level - operators - Scaling.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 8 0.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "LinearOperator.h"
       4             : 
       5             : namespace elsa
       6             : {
       7             :     /**
       8             :      * @brief Operator representing a scaling operation.
       9             :      *
      10             :      * @author Matthias Wieczorek - initial code
      11             :      * @author Maximilian Hornung - minor fixes
      12             :      * @author Tobias Lasser - modularization, rewrite
      13             :      *
      14             :      * @tparam data_t data type for the domain and range of the operator, defaulting to real_t
      15             :      *
      16             :      * This class represents a linear operator A that scales the input, either by a scalar
      17             :      * or by a diagonal scaling matrix.
      18             :      */
      19             :     template <typename data_t = real_t>
      20             :     class Scaling : public LinearOperator<data_t>
      21             :     {
      22             :     public:
      23             :         /**
      24             :          * @brief Constructor for a scalar, isotropic scaling operator.
      25             :          *
      26             :          * @param[in] descriptor DataDescriptor describing the domain and the range of the operator
      27             :          * @param[in] scaleFactor the scalar factor to scale with
      28             :          */
      29             :         Scaling(const DataDescriptor& descriptor, data_t scaleFactor);
      30             : 
      31             :         /**
      32             :          * @brief Constructor for a diagonal, anisotropic scaling operator.
      33             :          *
      34             :          * @param[in] descriptor DataDescriptor describing the domain and the range of the operator
      35             :          * @param[in] scaleFactors a DataContainer containing the scaling factor to be put on the
      36             :          * diagonal
      37             :          */
      38             :         Scaling(const DataDescriptor& descriptor, const DataContainer<data_t>& scaleFactors);
      39             : 
      40             :         /// make copy constructor deletion explicit
      41             :         Scaling(const Scaling<data_t>&) = delete;
      42             : 
      43             :         /// default destructor
      44           0 :         ~Scaling() override = default;
      45             : 
      46             :         /// is the scaling isotropic
      47             :         bool isIsotropic() const;
      48             : 
      49             :         /// returns the scale factor (throws if scaling is not isotropic)
      50             :         data_t getScaleFactor() const;
      51             : 
      52             :         /// returns the scale factors (throws if scaling is isotropic)
      53             :         const DataContainer<data_t>& getScaleFactors() const;
      54             : 
      55             :     protected:
      56             :         /// apply the scaling operation
      57             :         void applyImpl(const DataContainer<data_t>& x, DataContainer<data_t>& Ax) const override;
      58             : 
      59             :         /// apply the adjoint of the scaling operation
      60             :         void applyAdjointImpl(const DataContainer<data_t>& y,
      61             :                               DataContainer<data_t>& Aty) const override;
      62             : 
      63             :         /// implement the polymorphic clone operation
      64             :         Scaling<data_t>* cloneImpl() const override;
      65             : 
      66             :         /// implement the polymorphic comparison operation
      67             :         bool isEqual(const LinearOperator<data_t>& other) const override;
      68             : 
      69             :     private:
      70             :         /// flag if the scaling is isotropic
      71             :         bool _isIsotropic;
      72             : 
      73             :         /// isotropic scaling factor
      74             :         data_t _scaleFactor;
      75             : 
      76             :         /// anisotropic scaling factors
      77             :         std::unique_ptr<const DataContainer<data_t>> _scaleFactors{};
      78             :     };
      79             : 
      80             : } // namespace elsa

Generated by: LCOV version 1.14