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