53 template<
typename dtype>
62 auto sum =
static_cast<double>(
63 std::accumulate(inArray.
cbegin(),
66 [](dtype inValue1, dtype inValue2) -> dtype
67 { return std::isnan(inValue2) ? inValue1 : inValue1 + inValue2; }));
69 const auto numberNonNan =
70 static_cast<double>(std::accumulate(inArray.
cbegin(),
73 [](dtype inValue1, dtype inValue2) -> dtype
74 { return std::isnan(inValue2) ? inValue1 : inValue1 + 1; }));
84 for (
uint32 row = 0; row < inShape.
rows; ++row)
86 auto sum =
static_cast<double>(
87 std::accumulate(inArray.
cbegin(row),
90 [](dtype inValue1, dtype inValue2) -> dtype
91 { return std::isnan(inValue2) ? inValue1 : inValue1 + inValue2; }));
93 auto numberNonNan =
static_cast<double>(
94 std::accumulate(inArray.
cbegin(row),
97 [](dtype inValue1, dtype inValue2) -> dtype
98 { return std::isnan(inValue2) ? inValue1 : inValue1 + 1; }));
100 returnArray(0, row) =
sum / numberNonNan;
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition: Error.hpp:37
#define STATIC_ASSERT_FLOAT(dtype)
Definition: StaticAsserts.hpp:50
const_iterator cbegin() const noexcept
Definition: NdArrayCore.hpp:1365
self_type transpose() const
Definition: NdArrayCore.hpp:4963
const Shape & shape() const noexcept
Definition: NdArrayCore.hpp:4591
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1673
A Shape Class for NdArrays.
Definition: Core/shape.hpp:41
uint32 rows
Definition: Core/shape.hpp:44
Definition: Cartesian.hpp:40
Axis
Enum To describe an axis.
Definition: Enums.hpp:36
NdArray< dtype > sum(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: sum.hpp:46
NdArray< double > nanmean(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: nanmean.hpp:54
std::uint32_t uint32
Definition: Types.hpp:40