51 template<
typename dtype>
56 double meanValue = 0.;
59 const auto function = [&
sum, &meanValue](dtype value) ->
void
60 {
sum +=
utils::sqr(
static_cast<double>(value) - meanValue); };
66 meanValue =
mean(inArray, inAxis).
item();
78 meanValue = meanValueArray[row];
109 template<
typename dtype>
114 std::complex<double> meanValue(0., 0.);
115 std::complex<double>
sum(0., 0.);
117 const auto function = [&
sum, &meanValue](std::complex<dtype> value) ->
void
118 {
sum +=
utils::sqr(complex_cast<double>(value) - meanValue); };
124 meanValue =
mean(inArray, inAxis).
item();
134 for (
uint32 row = 0; row < inArray.numRows(); ++row)
136 meanValue = meanValueArray[row];
137 sum = std::complex<double>(0., 0.);
138 std::for_each(inArray.cbegin(row), inArray.cend(row), function);
140 returnArray(0, row) =
std::sqrt(
sum /
static_cast<double>(inArray.numCols()));
152 meanValue = meanValueArray[row];
153 sum = std::complex<double>(0., 0.);
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition: Error.hpp:37
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition: StaticAsserts.hpp:39
size_type size() const noexcept
Definition: NdArrayCore.hpp:4524
const_iterator cbegin() const noexcept
Definition: NdArrayCore.hpp:1365
self_type transpose() const
Definition: NdArrayCore.hpp:4882
size_type numCols() const noexcept
Definition: NdArrayCore.hpp:3465
size_type numRows() const noexcept
Definition: NdArrayCore.hpp:3477
const_iterator cend() const noexcept
Definition: NdArrayCore.hpp:1673
value_type item() const
Definition: NdArrayCore.hpp:3022
void for_each(InputIt first, InputIt last, UnaryFunction f)
Definition: StlAlgorithms.hpp:225
constexpr dtype sqr(dtype inValue) noexcept
Definition: sqr.hpp:42
Definition: Cartesian.hpp:40
NdArray< double > mean(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: mean.hpp:52
NdArray< double > stdev(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: stdev.hpp:52
Axis
Enum To describe an axis.
Definition: Enums.hpp:36
auto sqrt(dtype inValue) noexcept
Definition: sqrt.hpp:48
NdArray< dtype > sum(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition: sum.hpp:46
std::uint32_t uint32
Definition: Types.hpp:40