NumCpp  2.4.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
applyFunction.hpp
Go to the documentation of this file.
1 #pragma once
29 
31 #include "NumCpp/NdArray.hpp"
32 
33 #include <functional>
34 
35 namespace nc
36 {
37  //============================================================================
38  // Method Description:
47  template<typename dtype>
48  void applyFunction(NdArray<dtype>& inArray, const std::function<dtype(dtype)>& inFunc)
49  {
50  stl_algorithms::transform(inArray.begin(), inArray.end(), inArray.begin(), inFunc);
51  }
52 } // namespace nc
nc::applyFunction
void applyFunction(NdArray< dtype > &inArray, const std::function< dtype(dtype)> &inFunc)
Definition: applyFunction.hpp:48
nc::NdArray< dtype >
nc::stl_algorithms::transform
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition: StlAlgorithms.hpp:702
NdArray.hpp
nc::NdArray::end
iterator end() noexcept
Definition: NdArrayCore.hpp:1431
nc
Definition: Coordinate.hpp:44
StlAlgorithms.hpp
nc::NdArray::begin
iterator begin() noexcept
Definition: NdArrayCore.hpp:1087