54 template<
typename dtype>
63 auto sum =
static_cast<double>(std::accumulate(inArray.
cbegin(), inArray.
cend(), 0.0,
64 [](dtype inValue1, dtype inValue2) -> dtype
66 return std::isnan(inValue2) ? inValue1 : inValue1 + inValue2;
69 const auto numberNonNan =
static_cast<double>(std::accumulate(inArray.
cbegin(), inArray.
cend(), 0.0,
70 [](dtype inValue1, dtype inValue2) -> dtype
72 return std::isnan(inValue2) ? inValue1 : inValue1 + 1;
83 for (
uint32 row = 0; row < inShape.
rows; ++row)
85 auto sum =
static_cast<double>(std::accumulate(inArray.
cbegin(row), inArray.
cend(row), 0.0,
86 [](dtype inValue1, dtype inValue2) -> dtype
88 return std::isnan(inValue2) ? inValue1 : inValue1 + inValue2;
91 auto numberNonNan =
static_cast<double>(std::accumulate(inArray.
cbegin(row), inArray.
cend(row), 0.0,
92 [](dtype inValue1, dtype inValue2) -> dtype
94 return std::isnan(inValue2) ? inValue1 : inValue1 + 1;
97 returnArray(0, row) =
sum / numberNonNan;
105 const Shape transShape = transposedArray.
shape();
107 for (
uint32 row = 0; row < transShape.
rows; ++row)
109 auto sum =
static_cast<double>(std::accumulate(transposedArray.
cbegin(row), transposedArray.
cend(row), 0.0,
110 [](dtype inValue1, dtype inValue2) -> dtype
112 return std::isnan(inValue2) ? inValue1 : inValue1 + inValue2;
115 auto numberNonNan =
static_cast<double>(std::accumulate(transposedArray.
cbegin(row), transposedArray.
cend(row), 0.0,
116 [](dtype inValue1, dtype inValue2) -> dtype
118 return std::isnan(inValue2) ? inValue1 : inValue1 + 1;
121 returnArray(0, row) =
sum / numberNonNan;