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.
 
void eis::difference (std::vector< eis::DataPoint > &a, const std::vector< eis::DataPoint > &b)
 Calculates the difference between two spectra.
 
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 from the data.
 
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.

◆ difference()

void eis::difference ( std::vector< eis::DataPoint > & a,
const std::vector< eis::DataPoint > & b )

Calculates the difference between two spectra.

this function calculates an element wise a = a-b and ingores omega

Parameters
aThe first operand, where b is subtracted
bThe second operand that is subtracted from the first, must be the same size as a

◆ 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 variance.

◆ 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 from 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.