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

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "CUDADefines.h"
       4             : #include <thrust/complex.h>
       5             : #include <complex>
       6             : 
       7             : namespace elsa
       8             : {
       9             :     namespace detail
      10             :     {
      11             :         struct abs_fn {
      12             :             template <class T>
      13             :             __host__ constexpr auto operator()(const T& arg) const noexcept
      14             :                 -> decltype(std::abs(std::declval<T>()))
      15      101062 :             {
      16      101062 :                 return std::abs(arg);
      17      101062 :             }
      18             : 
      19             :             template <class T>
      20             :             __host__ __device__ constexpr auto
      21             :                 operator()(const thrust::complex<T>& arg) const noexcept
      22             :                 -> decltype(thrust::abs(std::declval<thrust::complex<T>>()))
      23      127966 :             {
      24      127966 :                 return thrust::abs(arg);
      25      127966 :             }
      26             :         };
      27             :     } // namespace detail
      28             : 
      29             :     static constexpr __device__ detail::abs_fn abs;
      30             : } // namespace elsa

Generated by: LCOV version 1.14