v2.0.0
Loading...
Searching...
No Matches
UTILSLIB::Numerics Class Reference

Static numerical utility functions. More...

#include <numerics.h>

Public Member Functions

 ~Numerics ()=default

Static Public Member Functions

static int gcd (int iA, int iB)
static bool issparse (Eigen::VectorXd &v)
static int nchoose2 (int n)
static Eigen::MatrixXd rescale (const Eigen::MatrixXd &data, const Eigen::RowVectorXf &times, const QPair< float, float > &baseline, QString mode)
static Eigen::MatrixXd rescale (const Eigen::MatrixXd &data, const Eigen::RowVectorXf &times, const std::pair< float, float > &baseline, const std::string &mode)
template<typename T>
static double log2 (const T d)
template<typename T>
static void histcounts (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &matRawData, bool bMakeSymmetrical, int iClassAmount, Eigen::VectorXd &vecResultClassLimits, Eigen::VectorXi &vecResultFrequency, double dGlobalMin=0.0, double dGlobalMax=0.0)
template<typename T>
static void histcounts (const Eigen::Matrix< T, Eigen::Dynamic, 1 > &matRawData, bool bMakeSymmetrical, int iClassAmount, Eigen::VectorXd &vecResultClassLimits, Eigen::VectorXi &vecResultFrequency, double dGlobalMin=0.0, double dGlobalMax=0.0)
template<typename T>
static void histcounts (const Eigen::Matrix< T, 1, Eigen::Dynamic > &matRawData, bool bMakeSymmetrical, int iClassAmount, Eigen::VectorXd &vecResultClassLimits, Eigen::VectorXi &vecResultFrequency, double dGlobalMin=0.0, double dGlobalMax=0.0)

Detailed Description

Static numerical utility functions.

General numerical utility functions: GCD, log2, histograms, baseline rescaling, etc.

Definition at line 73 of file numerics.h.

Constructor & Destructor Documentation

◆ ~Numerics()

UTILSLIB::Numerics::~Numerics ( )
default

Destroys the Numerics object.

Member Function Documentation

◆ gcd()

int Numerics::gcd ( int iA,
int iB )
static

Finds the Greatest Common Divisor (GCD) of two integer values.

Parameters
[in]iAFirst input integer.
[in]iBSecond input integer.
Returns
The Greatest Common Divisor (GCD) of iA and iB.

Definition at line 62 of file numerics.cpp.

◆ histcounts() [1/3]

template<typename T>
void UTILSLIB::Numerics::histcounts ( const Eigen::Matrix< T, 1, Eigen::Dynamic > & matRawData,
bool bMakeSymmetrical,
int iClassAmount,
Eigen::VectorXd & vecResultClassLimits,
Eigen::VectorXi & vecResultFrequency,
double dGlobalMin = 0.0,
double dGlobalMax = 0.0 )
static

Definition at line 229 of file numerics.h.

◆ histcounts() [2/3]

template<typename T>
void UTILSLIB::Numerics::histcounts ( const Eigen::Matrix< T, Eigen::Dynamic, 1 > & matRawData,
bool bMakeSymmetrical,
int iClassAmount,
Eigen::VectorXd & vecResultClassLimits,
Eigen::VectorXi & vecResultFrequency,
double dGlobalMin = 0.0,
double dGlobalMax = 0.0 )
static

Definition at line 213 of file numerics.h.

◆ histcounts() [3/3]

template<typename T>
void UTILSLIB::Numerics::histcounts ( const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > & matRawData,
bool bMakeSymmetrical,
int iClassAmount,
Eigen::VectorXd & vecResultClassLimits,
Eigen::VectorXi & vecResultFrequency,
double dGlobalMin = 0.0,
double dGlobalMax = 0.0 )
static

Creates a class and frequency distribution from data matrix.

Parameters
[in]matRawDataRaw data matrix that needs to be analyzed.
[in]bMakeSymmetricalUser input to turn the x-axis symmetric.
[in]iClassAmountUser input to determine the amount of classes in the histogram.
[out]vecResultClassLimitsThe upper limit of each individual class.
[out]vecResultFrequencyThe amount of data that fits in the appropriate class ranges.
[in]dGlobalMinUser input to determine the minimum value allowed in the histogram.
[in]dGlobalMaxUser input to determine the maximum value allowed in the histogram.

Definition at line 245 of file numerics.h.

◆ issparse()

bool Numerics::issparse ( Eigen::VectorXd & v)
static

Determines if a given data (stored as vector v) are representing a sparse matrix.

Parameters
[in]vData to be tested.
Returns
true if sparse, false otherwise.

Definition at line 73 of file numerics.cpp.

◆ log2()

template<typename T>
double UTILSLIB::Numerics::log2 ( const T d)
inlinestatic

Compute log base 2 of a given number.

Parameters
[in]dInput value.
Returns
log2 of d.

Definition at line 205 of file numerics.h.

◆ nchoose2()

int Numerics::nchoose2 ( int n)
static

Calculates the combination of n over 2 (nchoosek(n,2)).

Parameters
[in]nThe number of elements which should be combined with each other (n over 2).
Returns
The number of combinations.

Definition at line 92 of file numerics.cpp.

◆ rescale() [1/2]

Eigen::MatrixXd UTILSLIB::Numerics::rescale ( const Eigen::MatrixXd & data,
const Eigen::RowVectorXf & times,
const QPair< float, float > & baseline,
QString mode )
static

Rescale (baseline correct) data.

Parameters
[in]dataData Matrix (m x n_time).
[in]timesTime instants in seconds.
[in]baselineIf baseline is (a, b) the interval is between "a (s)" and "b (s)". If a and b are equal, use interval between the beginning of the data and time 0.
[in]modeBaseline correction mode: "logratio" | "ratio" | "zscore" | "mean" | "percent".
Returns
Rescaled data matrix.

◆ rescale() [2/2]

Eigen::MatrixXd UTILSLIB::Numerics::rescale ( const Eigen::MatrixXd & data,
const Eigen::RowVectorXf & times,
const std::pair< float, float > & baseline,
const std::string & mode )
static

Rescale (baseline correct) data.

Parameters
[in]dataData Matrix (m x n_time).
[in]timesTime instants in seconds.
[in]baselineIf baseline is (a, b) the interval is between "a (s)" and "b (s)". If a and b are equal, use interval between the beginning of the data and time 0.
[in]modeBaseline correction mode: "logratio" | "ratio" | "zscore" | "mean" | "percent".
Returns
Rescaled data matrix.

The documentation for this class was generated from the following files: