NumCpp  2.1.0
A C++ implementation of the Python Numpy library
applyFunction.hpp
Go to the documentation of this file.
1 #pragma once
30 
32 #include "NumCpp/NdArray.hpp"
33 
34 #include <functional>
35 
36 namespace nc
37 {
38  //============================================================================
39  // Method Description:
48  template<typename dtype>
49  void applyFunction(NdArray<dtype>& inArray, const std::function<dtype(dtype)>& inFunc)
50  {
51  stl_algorithms::transform(inArray.begin(), inArray.end(), inArray.begin(), inFunc);
52  }
53 } // namespace nc
nc::applyFunction
void applyFunction(NdArray< dtype > &inArray, const std::function< dtype(dtype)> &inFunc)
Definition: applyFunction.hpp:49
nc::NdArray< dtype >
nc::stl_algorithms::transform
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition: StlAlgorithms.hpp:703
NdArray.hpp
nc::NdArray::end
iterator end() noexcept
Definition: NdArrayCore.hpp:1435
nc
Definition: Coordinate.hpp:45
StlAlgorithms.hpp
nc::NdArray::begin
iterator begin() noexcept
Definition: NdArrayCore.hpp:1091