NumCpp  2.1.0
A C++ implementation of the Python Numpy library
proj.hpp
Go to the documentation of this file.
1 #pragma once
30 
33 #include "NumCpp/NdArray.hpp"
34 
35 #include <complex>
36 
37 namespace nc
38 {
39  //============================================================================
40  // Method Description:
48  template<typename dtype>
49  auto proj(const std::complex<dtype>& inValue)
50  {
52 
53  return std::proj(inValue);
54  }
55 
56  //============================================================================
57  // Method Description:
65  template<typename dtype>
66  auto proj(const NdArray<std::complex<dtype>>& inArray)
67  {
68  NdArray<decltype(nc::proj(std::complex<dtype>{0}))> returnArray(inArray.shape());
69  stl_algorithms::transform(inArray.cbegin(), inArray.cend(), returnArray.begin(),
70  [](auto& inValue) -> auto
71  {
72  return nc::proj(inValue);
73  });
74 
75  return returnArray;
76  }
77 } // namespace nc
StaticAsserts.hpp
STATIC_ASSERT_ARITHMETIC
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:38
nc::proj
auto proj(const std::complex< dtype > &inValue)
Definition: proj.hpp:49
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::proj
auto proj(const NdArray< std::complex< dtype >> &inArray)
Definition: proj.hpp:66
nc
Definition: Coordinate.hpp:45
StlAlgorithms.hpp
nc::NdArray::begin
iterator begin() noexcept
Definition: NdArrayCore.hpp:1091