NumCpp
2.1.0
A C++ implementation of the Python Numpy library
angle.hpp
Go to the documentation of this file.
1
#pragma once
30
31
#include "
NumCpp/Core/Internal/StaticAsserts.hpp
"
32
#include "
NumCpp/Core/Internal/StlAlgorithms.hpp
"
33
#include "
NumCpp/NdArray.hpp
"
34
35
#include <complex>
36
37
namespace
nc
38
{
39
//============================================================================
40
// Method Description:
50
template
<
typename
dtype>
51
auto
angle
(
const
std::complex<dtype>& inValue)
52
{
53
STATIC_ASSERT_ARITHMETIC
(dtype);
54
55
return
std::arg(inValue);
56
}
57
58
//============================================================================
59
// Method Description:
69
template
<
typename
dtype>
70
auto
angle
(
const
NdArray
<std::complex<dtype>>& inArray)
71
{
72
NdArray
<decltype(
angle
(std::complex<dtype>{0}))> returnArray(inArray.shape());
73
stl_algorithms::transform
(inArray.cbegin(), inArray.cend(), returnArray.
begin
(),
74
[](
auto
& inValue) ->
auto
75
{
76
return angle(inValue);
77
});
78
79
return
returnArray;
80
}
81
}
// namespace nc
StaticAsserts.hpp
STATIC_ASSERT_ARITHMETIC
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition:
StaticAsserts.hpp:38
nc::NdArray
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition:
NdArrayCore.hpp:75
nc::stl_algorithms::transform
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition:
StlAlgorithms.hpp:703
NdArray.hpp
nc::angle
auto angle(const std::complex< dtype > &inValue)
Definition:
angle.hpp:51
nc
Definition:
Coordinate.hpp:45
StlAlgorithms.hpp
nc::NdArray::begin
iterator begin() noexcept
Definition:
NdArrayCore.hpp:1091
include
NumCpp
Functions
angle.hpp
Generated by
1.8.17