eisgenerator 1.0.x
Functions
Math

Various math functions performed on eisgenerator types. More...

Functions

std::complex< fvalue > eis::absGrad (const std::vector< eis::DataPoint > &data, size_t index)
 Calculates the element wise absolute gradient at the given point of the data given.
 
fvalue eis::grad (const std::vector< fvalue > &data, const std::vector< fvalue > &omega, size_t index)
 Calculates derivative at the given point of the data given.
 
std::complex< fvalue > eis::grad (const std::vector< eis::DataPoint > &data, size_t index)
 Calculates the gradient at the given point of the data given.
 
fvalue eis::mean (const std::vector< fvalue > &data)
 Calculates the mean of the given data.
 
std::complex< fvalue > eis::mean (const std::vector< eis::DataPoint > &data)
 Calculates the mean of the given data.
 
fvalue eis::median (std::vector< fvalue > data)
 Calculates the median of the given data.
 
std::complex< fvalue > eis::median (const std::vector< eis::DataPoint > &data)
 Calculates the median of the given data.
 
std::vector< eis::DataPointeis::rescale (const std::vector< eis::DataPoint > &data, size_t outputSize)
 Resamples the data to the given amount of points.
 
fvalue eis::pearsonCorrelation (const std::vector< eis::DataPoint > &data)
 Calculates the Pearson correlation between the imaginary and the real part of the data.
 
fvalue eis::nyquistAreaVariance (const std::vector< eis::DataPoint > &data, eis::DataPoint *centroid=nullptr)
 Calculates the variance of the distance of the data from a centroid in the nyquist plane.
 
fvalue eis::maximumNyquistJump (const std::vector< eis::DataPoint > &data)
 Finds the maximum distance between subsequent points in the data in the nyquist plane.
 
void eis::noise (std::vector< eis::DataPoint > &data, double amplitude, bool relative)
 Adds white noise to the data.
 
void eis::removeDuplicates (std::vector< eis::DataPoint > &data)
 Removes duplicate data points form the data duplicates are detected by checking the value of omega for sameness using fvalueEq with the default ulp.
 
bool eis::fvalueEq (fvalue a, fvalue b, unsigned int ulp=4)
 Checks two fvalues for equality.
 
std::vector< eis::DataPointeis::fitToFrequencies (std::vector< fvalue > omegas, const std::vector< eis::DataPoint > &data, bool linearExtrapolation=false)
 this function resamples, extrapolates and interpolates to fit the data given to the frequencies also given
 

Detailed Description

Various math functions performed on eisgenerator types.

Function Documentation

◆ absGrad()

std::complex< fvalue > eis::absGrad ( const std::vector< eis::DataPoint > &  data,
size_t  index 
)

Calculates the element wise absolute gradient at the given point of the data given.

Parameters
datathe data to calculate the gradient on
indexthe position in the data to calculate the gradient at
Returns
the element wise absolute gradient abs(re(grad(a)))+abs(im(grad(a)))i

◆ fitToFrequencies()

std::vector< eis::DataPoint > eis::fitToFrequencies ( std::vector< fvalue >  omegas,
const std::vector< eis::DataPoint > &  data,
bool  linearExtrapolation = false 
)

this function resamples, extrapolates and interpolates to fit the data given to the frequencies also given

Data is resampled to the target size, interpolation for data points is performed using linear interpolation extrapolation is performed using linear or base 10 logarithmic extrapolation.

Parameters
omegasthe frequencies to resample the data to
datathe data to resample
linearExtrapolationtrue if linear extrapolation is to be performed, otherwise base 10 logarithmic extrapolation is used
Returns
the resampled data

◆ fvalueEq()

bool eis::fvalueEq ( fvalue  a,
fvalue  b,
unsigned int  ulp = 4 
)

Checks two fvalues for equality.

Equality is considered given when the values are within ulp epsilons at the magnitude of the sum of operands.

Parameters
athe first value to compare
bthe second value to compare
Returns
true if equal, false if unequal

◆ grad() [1/2]

std::complex< fvalue > eis::grad ( const std::vector< eis::DataPoint > &  data,
size_t  index 
)

Calculates the gradient at the given point of the data given.

Parameters
datathe data to calculate the gradient on
indexthe position in the data to calculate the gradient at
Returns
the gradient

◆ grad() [2/2]

fvalue eis::grad ( const std::vector< fvalue > &  data,
const std::vector< fvalue > &  omega,
size_t  index 
)

Calculates derivative at the given point of the data given.

Parameters
datathe data to calculate the gradient on
indexthe position in the data to calculate the gradient at
Returns
the derivative

◆ maximumNyquistJump()

fvalue eis::maximumNyquistJump ( const std::vector< eis::DataPoint > &  data)

Finds the maximum distance between subsequent points in the data in the nyquist plane.

Parameters
datathe data to use
Returns
the largest distance

◆ mean() [1/2]

std::complex< fvalue > eis::mean ( const std::vector< eis::DataPoint > &  data)

Calculates the mean of the given data.

Parameters
datathe data to calculate the mean of
Returns
the mean

◆ mean() [2/2]

fvalue eis::mean ( const std::vector< fvalue > &  data)

Calculates the mean of the given data.

Parameters
datathe data to calculate the mean of
Returns
the mean

◆ median() [1/2]

std::complex< fvalue > eis::median ( const std::vector< eis::DataPoint > &  data)

Calculates the median of the given data.

Parameters
datathe data to calculate the median of
Returns
the median

◆ median() [2/2]

fvalue eis::median ( std::vector< fvalue >  data)

Calculates the median of the given data.

Parameters
datathe data to calculate the median of
Returns
the median

◆ noise()

void eis::noise ( std::vector< eis::DataPoint > &  data,
double  amplitude,
bool  relative 
)

Adds white noise to the data.

Parameters
datathe data to add noise to
amplitudethe amplitude of the noise
relativeif true the amplitude will be taken as relative to the magnitude of the data, otherwise it will be taken as an absolute value

◆ nyquistAreaVariance()

fvalue eis::nyquistAreaVariance ( const std::vector< eis::DataPoint > &  data,
eis::DataPoint centroid = nullptr 
)

Calculates the variance of the distance of the data from a centroid in the nyquist plane.

Parameters
datathe data to calculate on
centroidthe centroid to use, if nullptr is passed here, the mean of the data will be used as the centroid
Returns
the Pearson correlation coefficient

◆ pearsonCorrelation()

fvalue eis::pearsonCorrelation ( const std::vector< eis::DataPoint > &  data)

Calculates the Pearson correlation between the imaginary and the real part of the data.

Parameters
datadata to calculate the Pearson correlation on
Returns
the Pearson correlation coefficient

◆ removeDuplicates()

void eis::removeDuplicates ( std::vector< eis::DataPoint > &  data)

Removes duplicate data points form the data duplicates are detected by checking the value of omega for sameness using fvalueEq with the default ulp.

Parameters
datathe data to remove duplicates from

◆ rescale()

std::vector< eis::DataPoint > eis::rescale ( const std::vector< eis::DataPoint > &  data,
size_t  outputSize 
)

Resamples the data to the given amount of points.

Parameters
datadata to resample
outputSizesize to resample to
Returns
the resampled data