Line data Source code
1 : #include "L0PseudoNorm.h" 2 : #include "TypeCasts.hpp" 3 : 4 : namespace elsa 5 : { 6 : template <typename data_t> 7 : L0PseudoNorm<data_t>::L0PseudoNorm(const DataDescriptor& domainDescriptor) 8 : : Functional<data_t>(domainDescriptor) 9 8 : { 10 8 : } 11 : 12 : template <typename data_t> 13 : L0PseudoNorm<data_t>::L0PseudoNorm(const Residual<data_t>& residual) 14 : : Functional<data_t>(residual) 15 24 : { 16 24 : } 17 : 18 : template <typename data_t> 19 : auto L0PseudoNorm<data_t>::evaluateImpl(const DataContainer<data_t>& Rx) -> data_t 20 4 : { 21 4 : return static_cast<data_t>(Rx.l0PseudoNorm()); 22 4 : } 23 : 24 : template <typename data_t> 25 : void L0PseudoNorm<data_t>::getGradientInPlaceImpl([[maybe_unused]] DataContainer<data_t>& Rx) 26 4 : { 27 4 : throw std::logic_error("L0PseudoNorm: not differentiable, so no gradient! (busted!)"); 28 4 : } 29 : 30 : template <typename data_t> 31 : auto L0PseudoNorm<data_t>::getHessianImpl([[maybe_unused]] const DataContainer<data_t>& Rx) 32 : -> LinearOperator<data_t> 33 4 : { 34 4 : throw std::logic_error("L0PseudoNorm: not differentiable, so no Hessian! (busted!)"); 35 4 : } 36 : 37 : template <typename data_t> 38 : auto L0PseudoNorm<data_t>::cloneImpl() const -> L0PseudoNorm<data_t>* 39 18 : { 40 18 : return new L0PseudoNorm(this->getResidual()); 41 18 : } 42 : 43 : template <typename data_t> 44 : auto L0PseudoNorm<data_t>::isEqual(const Functional<data_t>& other) const -> bool 45 4 : { 46 4 : if (!Functional<data_t>::isEqual(other)) 47 0 : return false; 48 : 49 4 : return is<L0PseudoNorm>(other); 50 4 : } 51 : 52 : // ------------------------------------------ 53 : // explicit template instantiation 54 : template class L0PseudoNorm<float>; 55 : template class L0PseudoNorm<double>; 56 : } // namespace elsa