Line data Source code
1 : #pragma once 2 : 3 : #include "ProximityOperator.h" 4 : 5 : namespace elsa 6 : { 7 : /** 8 : * @brief Class representing the proximity operator of the l0 pseudo-norm 9 : * 10 : * @author Andi Braimllari - initial code 11 : * 12 : * @tparam data_t data type for the values of the operator, defaulting to real_t 13 : * 14 : * This class represents the hard thresholding operator, expressed by its apply method through 15 : * the function i.e. @f$ prox(v) = v·1_{\{|v| > t\}}. @f$ 16 : * 17 : * References: 18 : * http://sfb649.wiwi.hu-berlin.de/fedc_homepage/xplore/tutorials/xlghtmlnode93.html 19 : */ 20 : template <typename data_t = real_t> 21 : class HardThresholding : public ProximityOperator<data_t> 22 : { 23 : public: 24 : /** 25 : * @brief Construct a HardThresholding operator from the given DataDescriptor 26 : * 27 : * @param[in] descriptor DataDescriptor describing the operator values 28 : */ 29 : HardThresholding(const DataDescriptor& descriptor); 30 : 31 : /// default destructor 32 40 : ~HardThresholding() override = default; 33 : 34 : protected: 35 : /** 36 : * @brief apply the proximity operator of the l0 pseudo-norm to an element in the operator's 37 : * domain 38 : * 39 : * @param[in] v input DataContainer 40 : * @param[in] t input Threshold 41 : * @param[out] prox output DataContainer 42 : */ 43 : void applyImpl(const DataContainer<data_t>& v, geometry::Threshold<data_t> t, 44 : DataContainer<data_t>& prox) const override; 45 : 46 : /// implement the polymorphic clone operation 47 : auto cloneImpl() const -> HardThresholding<data_t>* override; 48 : 49 : /// implement the polymorphic comparison operation 50 : auto isEqual(const ProximityOperator<data_t>& other) const -> bool override; 51 : }; 52 : } // namespace elsa