open_iA 2025.6
Loading...
Searching...
No Matches
iAMathUtility.cpp File Reference
#include "iAMathUtility.h"
#include <numbers>

Functions

double covariance (FuncType const &func1, FuncType const &func2, double mean1, double mean2, bool correctDF)
 Compute covariance between two functions.
 
FuncType derivative (FuncType const &func)
 Calculate first derivative of a given function.
 
double gaussian (double x, double sigma)
 Compute Gaussian function for the given value x and parameter sigma (mean = 0).
 
FuncType gaussianKernel (double kernelSigma, size_t kernelSteps)
 Compute a gaussian kernel with the given sigma (mean = 0).
 
FuncType gaussianSmoothing (FuncType const &data, double kernelSigma, int kernelSteps)
 Convolutes the given function with a Gaussian kernel with the given sigma and steps.
 
FuncType getNormedRanks (FuncType const &func)
 Compute ranks for a given list of values.
 
double mean (FuncType const &func)
 Compute the mean of a collection of values.
 
double median (FuncType vec)
 Compute the median of a collection of values.
 
double pearsonsCorrelationCoefficient (FuncType const &func1, FuncType const &func2)
 Calculate the Pearson's correlation coefficient between two functions.
 
double spearmansCorrelationCoefficient (FuncType const &func1, FuncType const &func2)
 Calculate the Spearman's correlation coefficient between two functions.
 
double standardDeviation (FuncType const &func, double meanVal, bool correctDF)
 Compute the standard deviation of a function. mean can be given (to improve speed).
 
double variance (FuncType const &func, double meanVal, bool correctDF)
 Compute the variation of a function. If known, mean can be given (to improve speed).
 

Function Documentation

◆ covariance()

double covariance ( FuncType const & func1,
FuncType const & func2,
double mean1,
double mean2,
bool correctDF )

Compute covariance between two functions.

◆ derivative()

FuncType derivative ( FuncType const & func)

Calculate first derivative of a given function.

◆ gaussian()

double gaussian ( double x,
double sigma )

Compute Gaussian function for the given value x and parameter sigma (mean = 0).

◆ gaussianKernel()

FuncType gaussianKernel ( double kernelSigma,
size_t kernelSteps )

Compute a gaussian kernel with the given sigma (mean = 0).

◆ gaussianSmoothing()

FuncType gaussianSmoothing ( FuncType const & data,
double kernelSigma,
int kernelSteps )

Convolutes the given function with a Gaussian kernel with the given sigma and steps.

TODO: number of steps could be calculated from sigma (cut off kernel when factor gets very small)

◆ getNormedRanks()

FuncType getNormedRanks ( FuncType const & func)

Compute ranks for a given list of values.

◆ mean()

double mean ( FuncType const & func)

Compute the mean of a collection of values.

◆ median()

double median ( FuncType vec)

Compute the median of a collection of values.

◆ pearsonsCorrelationCoefficient()

double pearsonsCorrelationCoefficient ( FuncType const & func1,
FuncType const & func2 )

Calculate the Pearson's correlation coefficient between two functions.

◆ spearmansCorrelationCoefficient()

double spearmansCorrelationCoefficient ( FuncType const & func1,
FuncType const & func2 )

Calculate the Spearman's correlation coefficient between two functions.

◆ standardDeviation()

double standardDeviation ( FuncType const & func,
double meanVal,
bool correctDF )

Compute the standard deviation of a function. mean can be given (to improve speed).

◆ variance()

double variance ( FuncType const & func,
double meanVal,
bool correctDF )

Compute the variation of a function. If known, mean can be given (to improve speed).