NumCpp  2.12.1
A Templatized Header Only C++ Implementation of the Python NumPy Library
applyFunction.hpp
Go to the documentation of this file.
1
28#pragma once
29
30#include <functional>
31
33#include "NumCpp/NdArray.hpp"
34
35namespace nc
36{
37 //============================================================================
38 // Method Description:
45 template<typename dtype>
46 void applyFunction(NdArray<dtype>& inArray, const std::function<dtype(dtype)>& inFunc)
47 {
48 stl_algorithms::transform(inArray.begin(), inArray.end(), inArray.begin(), inFunc);
49 }
50} // namespace nc
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition: NdArrayCore.hpp:139
iterator end() noexcept
Definition: NdArrayCore.hpp:1623
iterator begin() noexcept
Definition: NdArrayCore.hpp:1315
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition: StlAlgorithms.hpp:775
Definition: Cartesian.hpp:40
void applyFunction(NdArray< dtype > &inArray, const std::function< dtype(dtype)> &inFunc)
Definition: applyFunction.hpp:46