NumCpp  2.9.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 
30 #include <functional>
31 
33 #include "NumCpp/NdArray.hpp"
34 
35 namespace nc
36 {
37  //============================================================================
38  // Method Description:
46  template<typename dtype>
47  void applyFunction(NdArray<dtype>& inArray, const std::function<dtype(dtype)>& inFunc)
48  {
49  stl_algorithms::transform(inArray.begin(), inArray.end(), inArray.begin(), inFunc);
50  }
51 } // namespace nc
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:72
iterator end() noexcept
Definition: NdArrayCore.hpp:1479
iterator begin() noexcept
Definition: NdArrayCore.hpp:1171
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition: StlAlgorithms.hpp:784
Definition: Coordinate.hpp:45
void applyFunction(NdArray< dtype > &inArray, const std::function< dtype(dtype)> &inFunc)
Definition: applyFunction.hpp:47