LCOV - code coverage report
Current view: top level - elsa/problems - RepresentationProblem.h (source / functions) Hit Total Coverage
Test: coverage-all.lcov Lines: 1 1 100.0 %
Date: 2022-08-25 03:05:39 Functions: 2 2 100.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "Dictionary.h"
       4             : #include "Problem.h"
       5             : 
       6             : namespace elsa
       7             : {
       8             :     /**
       9             :      * @brief Class representing a sparse representation problem.
      10             :      *
      11             :      * @author Jonas Buerger - initial code
      12             :      *
      13             :      * @tparam data_t data type for the domain and range of the problem, defaulting to real_t
      14             :      *
      15             :      * This class represents a sparse representation problem, i.e.
      16             :      * \f$ \min_x \| x \|_0 \f$, s.t. \f$ \| y - Dx \|_2^2 < \epsilon \f$, where \f$ D \f$ is a
      17             :      * dictionary operator, \f$ y \f$ is the signal that should be represented, \f$ x \f$ is the
      18             :      * sparse representation vector and \f$ \epsilon \f$ is some error bound.
      19             :      * The sparsity condition \f$ \min_x \|\| x \|\|_0 \f$ is not enforced by the class but handled
      20             :      * implicitly, either by using a greedy algorithm that starts with the 0-vector as a
      21             :      * representation or by creating another problem that explicitly takes sparsity into account and
      22             :      * relaxes the L0-Norm to the L1-Norm.
      23             :      */
      24             :     template <typename data_t = real_t>
      25             :     class RepresentationProblem : public Problem<data_t>
      26             :     {
      27             :     public:
      28             :         /**
      29             :          * @brief Constructor for the representation problem, accepting D and y
      30             :          *
      31             :          * @param[in] D dictionary operator
      32             :          * @param[in] y signal that should be sparsely represented
      33             :          */
      34             :         RepresentationProblem(const Dictionary<data_t>& D, const DataContainer<data_t>& y);
      35             : 
      36             :         /// default destructor
      37          15 :         ~RepresentationProblem() override = default;
      38             : 
      39             :         const Dictionary<data_t>& getDictionary() const;
      40             : 
      41             :         const DataContainer<data_t>& getSignal() const;
      42             : 
      43             :     protected:
      44             :         /// implement the polymorphic clone operation
      45             :         RepresentationProblem<data_t>* cloneImpl() const override;
      46             : 
      47             :         /// override getGradient and throw exception if called because L0-Norm, even though only
      48             :         /// enforced implicitly, is not differtiable
      49             :         void getGradientImpl(DataContainer<data_t>& result) override;
      50             : 
      51             :     private:
      52             :         Dictionary<data_t> _dict;
      53             : 
      54             :         DataContainer<data_t> _signal;
      55             :     };
      56             : } // namespace elsa

Generated by: LCOV version 1.14