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 l1 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 soft thresholding operator, expressed by its apply method through 15 : * the function i.e. @f$ prox(v) = sign(v)ยท(|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 SoftThresholding : public ProximityOperator<data_t> 22 : { 23 : public: 24 : /** 25 : * @brief Construct a SoftThresholding operator from the given DataDescriptor 26 : * 27 : * @param[in] descriptor DataDescriptor describing the operator values 28 : */ 29 : SoftThresholding(const DataDescriptor& descriptor); 30 : 31 : /// default destructor 32 0 : ~SoftThresholding() override = default; 33 : 34 : protected: 35 : /** 36 : * @brief apply the proximity operator of the l1 norm to an element in the operator's domain 37 : * 38 : * @param[in] v input DataContainer 39 : * @param[in] t input Threshold 40 : * @param[out] prox output DataContainer 41 : */ 42 : void applyImpl(const DataContainer<data_t>& v, geometry::Threshold<data_t> t, 43 : DataContainer<data_t>& prox) const override; 44 : 45 : /// implement the polymorphic clone operation 46 : auto cloneImpl() const -> SoftThresholding<data_t>* override; 47 : 48 : /// implement the polymorphic comparison operation 49 : auto isEqual(const ProximityOperator<data_t>& other) const -> bool override; 50 : }; 51 : } // namespace elsa