NumCpp  2.1.0
A C++ implementation of the Python Numpy library
deg2rad.hpp
Go to the documentation of this file.
1 #pragma once
30 
34 #include "NumCpp/NdArray.hpp"
35 
36 namespace nc
37 {
38  //============================================================================
39  // Method Description:
49  template<typename dtype>
50  constexpr auto deg2rad(dtype inValue) noexcept
51  {
53 
54  return inValue * constants::pi / 180.0;
55  }
56 
57  //============================================================================
58  // Method Description:
68  template<typename dtype>
69  auto deg2rad(const NdArray<dtype>& inArray)
70  {
71  NdArray<decltype(deg2rad(dtype{0})) > returnArray(inArray.shape());
72  stl_algorithms::transform(inArray.cbegin(), inArray.cend(), returnArray.begin(),
73  [](dtype inValue) noexcept -> auto
74  {
75  return deg2rad(inValue);
76  });
77 
78  return returnArray;
79  }
80 } // namespace nc
StaticAsserts.hpp
nc::NdArray::shape
Shape shape() const noexcept
Definition: NdArrayCore.hpp:4312
STATIC_ASSERT_ARITHMETIC
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:38
Constants.hpp
nc::NdArray< dtype >
nc::deg2rad
constexpr auto deg2rad(dtype inValue) noexcept
Definition: deg2rad.hpp:50
nc::stl_algorithms::transform
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition: StlAlgorithms.hpp:703
NdArray.hpp
nc::NdArray::cend
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1491
nc::constants::pi
constexpr double pi
Pi.
Definition: Constants.hpp:44
nc
Definition: Coordinate.hpp:45
nc::NdArray::cbegin
const_iterator cbegin() const noexcept
Definition: NdArrayCore.hpp:1147
StlAlgorithms.hpp
nc::NdArray::begin
iterator begin() noexcept
Definition: NdArrayCore.hpp:1091