50 template<
typename dtype>
55 double squareSum = 0.;
56 const auto function = [&squareSum](dtype value) ->
void
57 { squareSum +=
utils::sqr(
static_cast<double>(value)); };
63 std::for_each(inArray.
cbegin(), inArray.
cend(), function);
64 NdArray<double> returnArray = { std::sqrt(squareSum /
static_cast<double>(inArray.
size())) };
73 std::for_each(inArray.
cbegin(row), inArray.
cend(row), function);
74 returnArray(0, row) = std::sqrt(squareSum /
static_cast<double>(inArray.
numCols()));
100 template<
typename dtype>
105 std::complex<double> squareSum = 0.;
106 const auto function = [&squareSum](std::complex<dtype> value) ->
void
113 std::for_each(inArray.cbegin(), inArray.cend(), function);
115 static_cast<double>(inArray.size())) };
121 for (
uint32 row = 0; row < inArray.numRows(); ++row)
123 squareSum = std::complex<double>(0., 0.);
124 std::for_each(inArray.cbegin(row), inArray.cend(row), function);
125 returnArray(0, row) = std::sqrt(squareSum /
static_cast<double>(inArray.numCols()));
#define THROW_INVALID_ARGUMENT_ERROR(msg)
Definition Error.hpp:37
#define STATIC_ASSERT_ARITHMETIC(dtype)
Definition StaticAsserts.hpp:39
Holds 1D and 2D arrays, the main work horse of the NumCpp library.
Definition NdArrayCore.hpp:139
size_type size() const noexcept
Definition NdArrayCore.hpp:4604
const_iterator cbegin() const noexcept
Definition NdArrayCore.hpp:1365
self_type transpose() const
Definition NdArrayCore.hpp:4963
size_type numCols() const noexcept
Definition NdArrayCore.hpp:3545
size_type numRows() const noexcept
Definition NdArrayCore.hpp:3557
const_iterator cend() const noexcept
Definition NdArrayCore.hpp:1673
constexpr dtype sqr(dtype inValue) noexcept
Definition sqr.hpp:42
Definition Cartesian.hpp:40
Axis
Enum To describe an axis.
Definition Enums.hpp:36
@ ROW
Definition Enums.hpp:38
@ COL
Definition Enums.hpp:39
@ NONE
Definition Enums.hpp:37
std::complex< Out > complex_cast(const std::complex< In > &value) noexcept
Definition StdComplexOperators.hpp:112
NdArray< double > rms(const NdArray< dtype > &inArray, Axis inAxis=Axis::NONE)
Definition rms.hpp:51
std::uint32_t uint32
Definition Types.hpp:40