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