dignea  1.0.0
Diverse Instance Generator with Novelty Search and Evolutionary Algorithms
Statistics.h File Reference
#include <algorithm>
#include <cmath>
#include <numeric>
#include <ranges>
#include <vector>

Go to the source code of this file.

Functions

template<typename T >
std::vector< float > normalize (vector< T > &vec)
 Normalizes a vector. Returns a copy of the vector normalized. More...
 
template<typename T >
double mean (const vector< T > &variables)
 Computes the mean value of the given vector. Returns NaN if empty. More...
 
template<typename T >
double mean (const vector< vector< T >> &matrix)
 Computes the mean value of the given matrix. Returns NaN if empty. More...
 
template<typename T >
double variance (const double &mean, const vector< T > &variables)
 Computes the variance of the vector based on the variables and the mean. Returns NaN if empty. More...
 
template<typename T >
double variance (const double &mean, const vector< vector< T >> &matrix)
 Computes the variance of the matrix based on the variables and the mean. Returns NaN if empty. More...
 
template<typename T >
double standardDev (double mean, const vector< T > &variables)
 Computes the Standard Deviation of the vector based on the mean value. Returns NaN if empty. More...
 
template<typename T >
double standardDev (double mean, const vector< vector< T >> &matrix)
 Computes the Standard Deviation of the matrix based on the mean value. Returns NaN if empty. More...
 
template<typename T >
median (const std::vector< T > &v)
 Computes the median of the vector. Returns NaN if empty. More...
 

Detailed Description

Author
Alejandro Marrero (amarr.nosp@m.erd@.nosp@m.ull.e.nosp@m.du.e.nosp@m.s)
Version
0.1
Date
2021-06-22

Function Documentation

◆ mean() [1/2]

template<typename T >
double mean ( const vector< T > &  variables)

Computes the mean value of the given vector. Returns NaN if empty.

Template Parameters
T
Parameters
variables
Returns

◆ mean() [2/2]

template<typename T >
double mean ( const vector< vector< T >> &  matrix)

Computes the mean value of the given matrix. Returns NaN if empty.

Template Parameters
T
Parameters
variables
Returns

◆ median()

template<typename T >
T median ( const std::vector< T > &  v)

Computes the median of the vector. Returns NaN if empty.

Template Parameters
T
Parameters
v
Returns
T

◆ normalize()

template<typename T >
std::vector<float> normalize ( vector< T > &  vec)

Normalizes a vector. Returns a copy of the vector normalized.

Template Parameters
T
Parameters
vec
Returns
std::vector<T>

◆ standardDev() [1/2]

template<typename T >
double standardDev ( double  mean,
const vector< T > &  variables 
)

Computes the Standard Deviation of the vector based on the mean value. Returns NaN if empty.

Template Parameters
T
Parameters
mean
variables
Returns

◆ standardDev() [2/2]

template<typename T >
double standardDev ( double  mean,
const vector< vector< T >> &  matrix 
)

Computes the Standard Deviation of the matrix based on the mean value. Returns NaN if empty.

Template Parameters
T
Parameters
mean
variables
Returns

◆ variance() [1/2]

template<typename T >
double variance ( const double &  mean,
const vector< T > &  variables 
)

Computes the variance of the vector based on the variables and the mean. Returns NaN if empty.

Template Parameters
T
Parameters
mean
variables
Returns

◆ variance() [2/2]

template<typename T >
double variance ( const double &  mean,
const vector< vector< T >> &  matrix 
)

Computes the variance of the matrix based on the variables and the mean. Returns NaN if empty.

Template Parameters
T
Parameters
mean
variables
Returns