LCOV - code coverage report
Current view: top level - elsa/storage/functions - Sign.hpp (source / functions) Hit Total Coverage
Test: coverage-all.lcov Lines: 12 12 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::fn
       8             : {
       9             :     namespace detail
      10             :     {
      11             :         struct sign_fn {
      12             :             template <class T>
      13             :             __host__ constexpr auto operator()(const T& arg) const noexcept
      14        9088 :             {
      15        9088 :                 return (T{0} < arg) - (arg < T{0});
      16        9088 :             }
      17             : 
      18             :             template <class T>
      19             :             __host__ __device__ constexpr auto
      20             :                 operator()(const thrust::complex<T>& arg) const noexcept -> T
      21         112 :             {
      22         112 :                 if (arg.real() > 0) {
      23          64 :                     return T{1};
      24          64 :                 } else if (arg.real() < 0) {
      25          55 :                     return T{-1};
      26 >1844*10^16 :                 } else {
      27 >1844*10^16 :                     return (*this)(arg.imag());
      28 >1844*10^16 :                 }
      29         112 :             }
      30             :         };
      31             :     } // namespace detail
      32             : 
      33             :     static constexpr __device__ detail::sign_fn sign;
      34             : } // namespace elsa::fn

Generated by: LCOV version 1.14