NumCpp  2.14.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
OutputIt transform(InputIt first, InputIt last, OutputIt destination, UnaryOperation unaryFunction)
Definition StlAlgorithms.hpp:775
Definition Cartesian.hpp:40
NdArray< dtype > arange(dtype inStart, dtype inStop, dtype inStep=1)
Definition arange.hpp:59
void applyFunction(NdArray< dtype > &inArray, const std::function< dtype(dtype)> &inFunc)
Definition applyFunction.hpp:46