LCOV - code coverage report
Current view: top level - elsa/storage/reductions - L1.h (source / functions) Hit Total Coverage
Test: coverage-all.lcov Lines: 4 4 100.0 %
Date: 2024-05-15 03:55:36 Functions: 9 9 100.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "TypeTraits.hpp"
       4             : #include "Functions.hpp"
       5             : #include "functions/Abs.hpp"
       6             : 
       7             : #include <thrust/transform_reduce.h>
       8             : #include <thrust/iterator/iterator_traits.h>
       9             : 
      10             : namespace elsa
      11             : {
      12             :     /// @brief Compute the l1 norm, i.e. the sum of absolute values, of the vector
      13             :     ///
      14             :     /// @ingroup reductions
      15             :     template <class InputIter>
      16             :     auto l1Norm(InputIter first, InputIter last) ->
      17             :         typename value_type_of<thrust::iterator_value_t<InputIter>>::type
      18         103 :     {
      19         103 :         using data_t = value_type_of_t<thrust::iterator_value_t<InputIter>>;
      20         103 :         return thrust::transform_reduce(first, last, elsa::abs, data_t(0), elsa::plus{});
      21         103 :     }
      22             : } // namespace elsa

Generated by: LCOV version 1.14