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