LCOV - code coverage report
Current view: top level - core/include/scipp/core/element - trigonometry.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 14 14 100.0 %
Date: 2024-04-28 01:25:40 Functions: 14 21 66.7 %

          Line data    Source code
       1             : // SPDX-License-Identifier: BSD-3-Clause
       2             : // Copyright (c) 2023 Scipp contributors (https://github.com/scipp)
       3             : /// @file
       4             : /// @author Owen Arnold
       5             : #pragma once
       6             : 
       7             : #include <cmath>
       8             : 
       9             : #include "scipp/common/overloaded.h"
      10             : #include "scipp/core/element/arg_list.h"
      11             : #include "scipp/core/transform_common.h"
      12             : 
      13             : namespace scipp::core::element {
      14             : constexpr auto trig = overloaded{arg_list<double, float>,
      15             :                                  transform_flags::expect_no_variance_arg<0>,
      16             :                                  transform_flags::expect_no_variance_arg<1>,
      17             :                                  transform_flags::expect_no_variance_arg<2>};
      18             : 
      19       68261 : constexpr auto sin = overloaded{trig, [](const auto &x) {
      20             :                                   using std::sin;
      21       68261 :                                   return sin(x);
      22             :                                 }};
      23             : 
      24          40 : constexpr auto cos = overloaded{trig, [](const auto &x) {
      25             :                                   using std::cos;
      26          40 :                                   return cos(x);
      27             :                                 }};
      28             : 
      29          45 : constexpr auto tan = overloaded{trig, [](const auto &x) {
      30             :                                   using std::tan;
      31          45 :                                   return tan(x);
      32             :                                 }};
      33             : 
      34          17 : constexpr auto asin = overloaded{trig, [](const auto x) {
      35             :                                    using std::asin;
      36          17 :                                    return asin(x);
      37             :                                  }};
      38             : 
      39          17 : constexpr auto acos = overloaded{trig, [](const auto x) {
      40             :                                    using std::acos;
      41          17 :                                    return acos(x);
      42             :                                  }};
      43             : 
      44          17 : constexpr auto atan = overloaded{trig, [](const auto x) {
      45             :                                    using std::atan;
      46          17 :                                    return atan(x);
      47             :                                  }};
      48             : 
      49          25 : constexpr auto atan2 = overloaded{trig, [](const auto y, const auto x) {
      50             :                                     using std::atan2;
      51          25 :                                     return atan2(y, x);
      52             :                                   }};
      53             : 
      54             : } // namespace scipp::core::element

Generated by: LCOV version 1.14