NumCpp  2.18.0
A Templatized Header Only C++ Implementation of the Python NumPy Library
Loading...
Searching...
No Matches
nancumsum.hpp
Go to the documentation of this file.
1
28#pragma once
29
30#include <cmath>
31
35#include "NumCpp/NdArray.hpp"
36
37namespace nc
38{
39 //============================================================================
40 // Method Description:
49 template<typename dtype>
51 {
53
54 NdArray<dtype> arrayCopy(inArray);
56 arrayCopy.end(),
57 [](dtype& value) noexcept -> void
58 {
59 if (std::isnan(value))
60 {
61 value = dtype{ 0 };
62 };
63 });
64
65 return cumsum(arrayCopy, inAxis);
66 }
67} // namespace nc
#define STATIC_ASSERT_FLOAT(dtype)
Definition StaticAsserts.hpp:50
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:135
iterator end() noexcept
Definition NdArrayCore.hpp:1619
iterator begin() noexcept
Definition NdArrayCore.hpp:1311
void for_each(InputIt first, InputIt last, UnaryFunction f)
Definition StlAlgorithms.hpp:226
Definition Cartesian.hpp:39
Axis
Enum To describe an axis.
Definition Enums.hpp:36
@ NONE
Definition Enums.hpp:37
NdArray< dtype > cumsum(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition cumsum.hpp:45
NdArray< dtype > nancumsum(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition nancumsum.hpp:50