11 template <
typename Type>
16 Type medianValue = Type(0);
17 double averageValue = 0.;
22 for (
const Type& v : values) {
30 averageValue /= values.
size();
34 std::nth_element(cloned.
begin(), cloned.
begin() + mid, cloned.
end());
35 medianValue = cloned[mid];
59 logger.
write(
"Min = " + std::to_string(
min()) +
"; Max = " + std::to_string(
max()) +
60 "; Mean = " + std::to_string(
average()) +
"; Median = " + std::to_string(
median()));
Simple non-owning view of a container.
Generic dynamically allocated resizable storage.
uint32_t Size
Integral type used to index arrays (by default).
double Float
Precision used withing the code. Use Float instead of float or double where precision is important.
Object representing interval of real values.
Logging routines of the run.
constexpr INLINE T max(const T &f1, const T &f2)
NAMESPACE_SPH_BEGIN constexpr INLINE T min(const T &f1, const T &f2)
Minimum & Maximum value.
#define INLINE
Macros for conditional compilation based on selected compiler.
#define NAMESPACE_SPH_END
ArrayStats(ArrayView< const Type > values)
INLINE Type average() const
INLINE Type median() const
void write(ILogger &logger)
INLINE Interval range() const
INLINE bool empty() const
INLINE TCounter size() const
INLINE Iterator< StorageType > begin()
INLINE Iterator< StorageType > end()
INLINE Iterator< StorageType > end() noexcept
INLINE Iterator< StorageType > begin() noexcept
void pushAll(const TIter first, const TIter last)
Interface providing generic (text, human readable) output of the program.
void write(TArgs &&... args)
Creates and logs a message by concatenating arguments.
Object representing a 1D interval of real numbers.