LCOV - code coverage report
Current view: top level - elsa/storage/functions - Imag.hpp (source / functions) Hit Total Coverage
Test: coverage-all.lcov Lines: 3 3 100.0 %
Date: 2024-05-16 04:22:26 Functions: 2 2 100.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "CUDADefines.h"
       4             : #include "TypeTraits.hpp"
       5             : #include <thrust/complex.h>
       6             : #include <complex>
       7             : 
       8             : namespace elsa::fn
       9             : {
      10             :     namespace detail
      11             :     {
      12             :         struct imag_fn {
      13             :             template <class T>
      14             :             __host__ __device__ constexpr auto operator()(const T&) const noexcept
      15             :                 -> std::enable_if_t<!is_complex_v<T>, T>
      16             :             {
      17             :                 return 0;
      18             :             }
      19             : 
      20             :             template <class T>
      21             :             __host__ __device__ constexpr auto
      22             :                 operator()(const thrust::complex<T>& arg) const noexcept
      23             :                 -> decltype(std::declval<thrust::complex<T>>().imag())
      24          34 :             {
      25          34 :                 return arg.imag();
      26          34 :             }
      27             : 
      28             :             template <class T>
      29             :             __host__ constexpr auto operator()(const std::complex<T>& arg) const noexcept
      30             :                 -> decltype(std::imag(std::declval<std::complex<T>>()))
      31             :             {
      32             :                 return std::imag(arg);
      33             :             }
      34             :         };
      35             :     } // namespace detail
      36             : 
      37             :     static constexpr __device__ detail::imag_fn imag;
      38             : } // namespace elsa::fn

Generated by: LCOV version 1.14