Line data Source code
1 : #include "RegularizationTerm.h" 2 : #include "L1Norm.h" 3 : 4 : namespace elsa 5 : { 6 : template <typename data_t> 7 : RegularizationTerm<data_t>::RegularizationTerm(data_t weight, 8 : const Functional<data_t>& functional) 9 : : _weight{weight}, _functional{functional.clone()} 10 191 : { 11 191 : } 12 : 13 : template <typename data_t> 14 : RegularizationTerm<data_t>::RegularizationTerm(const RegularizationTerm<data_t>& other) 15 : : _weight{other._weight}, _functional{other._functional->clone()} 16 517 : { 17 517 : } 18 : 19 : template <typename data_t> 20 : RegularizationTerm<data_t>& 21 : RegularizationTerm<data_t>::operator=(const RegularizationTerm<data_t>& other) 22 1 : { 23 1 : if (this != &other) { 24 1 : _weight = other._weight; 25 1 : _functional = other._functional->clone(); 26 1 : } 27 : 28 1 : return *this; 29 1 : } 30 : 31 : template <typename data_t> 32 : RegularizationTerm<data_t>::RegularizationTerm(RegularizationTerm<data_t>&& other) noexcept 33 : : _weight{std::move(other._weight)}, _functional{std::move(other._functional)} 34 1 : { 35 1 : } 36 : 37 : template <typename data_t> 38 : RegularizationTerm<data_t>& 39 : RegularizationTerm<data_t>::operator=(RegularizationTerm<data_t>&& other) noexcept 40 1 : { 41 1 : _weight = std::move(other._weight); 42 1 : _functional = std::move(other._functional); 43 : 44 1 : return *this; 45 1 : } 46 : 47 : template <typename data_t> 48 : data_t RegularizationTerm<data_t>::getWeight() const 49 185 : { 50 185 : return _weight; 51 185 : } 52 : 53 : template <typename data_t> 54 : Functional<data_t>& RegularizationTerm<data_t>::getFunctional() const 55 357 : { 56 357 : return *_functional; 57 357 : } 58 : 59 : template <typename data_t> 60 : bool RegularizationTerm<data_t>::operator==(const RegularizationTerm<data_t>& other) const 61 30 : { 62 30 : return (_weight == other._weight && *_functional == *other._functional); 63 30 : } 64 : 65 : template <typename data_t> 66 : bool RegularizationTerm<data_t>::operator!=(const RegularizationTerm<data_t>& other) const 67 26 : { 68 26 : return !operator==(other); 69 26 : } 70 : 71 : // ------------------------------------------ 72 : // explicit template instantiation 73 : template class RegularizationTerm<float>; 74 : template class RegularizationTerm<double>; 75 : template class RegularizationTerm<complex<float>>; 76 : template class RegularizationTerm<complex<double>>; 77 : 78 : } // namespace elsa