LCOV - code coverage report
Current view: top level - elsa/storage/transforms - Real.h (source / functions) Hit Total Coverage
Test: coverage-all.lcov Lines: 8 8 100.0 %
Date: 2024-05-16 04:22:26 Functions: 9 9 100.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "TypeTraits.hpp"
       4             : #include "functions/Real.hpp"
       5             : #include "transforms/Cast.h"
       6             : 
       7             : #include <thrust/transform.h>
       8             : #include <thrust/copy.h>
       9             : #include <thrust/iterator/iterator_traits.h>
      10             : 
      11             : namespace elsa
      12             : {
      13             :     /// @brief Extract the real part of a range. If the input range is not complex, it is equivalent
      14             :     /// to a copy.
      15             :     ///
      16             :     /// @ingroup transforms
      17             :     template <class InputIter, class OutIter>
      18             :     void real(InputIter first, InputIter last, OutIter out)
      19         217 :     {
      20         217 :         using indata_t = thrust::iterator_value_t<InputIter>;
      21             : 
      22             :         // If the input is not complex, the imaginary part will be 0
      23         217 :         if constexpr (!is_complex_v<indata_t>) {
      24         210 :             thrust::copy(first, last, out);
      25         210 :         } else {
      26         210 :             thrust::transform(first, last, out, elsa::fn::real);
      27         210 :         }
      28         217 :     }
      29             : } // namespace elsa

Generated by: LCOV version 1.14