MNE-CPP
0.1.9
A Framework for Electrophysiology
|
Math methods. More...
#include <mnemath.h>
Public Types | |
typedef std::pair< int, int > | IdxIntValue |
Public Member Functions | |
virtual | ~MNEMath () |
Static Public Member Functions | |
static int | gcd (int iA, int iB) |
static Eigen::VectorXd * | combine_xyz (const Eigen::VectorXd &vec) |
static double | getConditionNumber (const Eigen::MatrixXd &A, Eigen::VectorXd &s) |
static double | getConditionSlope (const Eigen::MatrixXd &A, Eigen::VectorXd &s) |
static void | get_whitener (Eigen::MatrixXd &A, bool pca, QString ch_type, Eigen::VectorXd &eig, Eigen::MatrixXd &eigvec) |
static void | get_whitener (Eigen::MatrixXd &A, bool pca, const std::string &ch_type, Eigen::VectorXd &eig, Eigen::MatrixXd &eigvec) |
static Eigen::VectorXi | intersect (const Eigen::VectorXi &v1, const Eigen::VectorXi &v2, Eigen::VectorXi &idx_sel) |
static bool | issparse (Eigen::VectorXd &v) |
static Eigen::MatrixXd | legendre (qint32 n, const Eigen::VectorXd &X, QString normalize=QString("unnorm")) |
static Eigen::MatrixXd | legendre (qint32 n, const Eigen::VectorXd &X, std::string normalize="unnorm") |
static Eigen::SparseMatrix< double > * | make_block_diag (const Eigen::MatrixXd &A, qint32 n) |
static int | nchoose2 (int n) |
static qint32 | rank (const Eigen::MatrixXd &A, double tol=1e-8) |
static Eigen::MatrixXd | rescale (const Eigen::MatrixXd &data, const Eigen::RowVectorXf ×, const QPair< float, float > &baseline, QString mode) |
static Eigen::MatrixXd | rescale (const Eigen::MatrixXd &data, const Eigen::RowVectorXf ×, const std::pair< float, float > &baseline, const std::string &mode) |
template<typename T > | |
static Eigen::VectorXi | sort (Eigen::Matrix< T, Eigen::Dynamic, 1 > &v, bool desc=true) |
template<typename T > | |
static Eigen::VectorXi | sort (Eigen::Matrix< T, Eigen::Dynamic, 1 > &v_prime, Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &mat, bool desc=true) |
template<typename T > | |
static std::vector< Eigen::Triplet< T > > | sortrows (const std::vector< Eigen::Triplet< T > > &A, qint32 column=0) |
template<typename T > | |
static bool | compareIdxValuePairBiggerThan (const std::pair< int, T > &lhs, const std::pair< int, T > &rhs) |
template<typename T > | |
static bool | compareIdxValuePairSmallerThan (const std::pair< int, T > &lhs, const std::pair< int, T > &rhs) |
template<typename T > | |
static bool | compareTripletFirstEntry (const Eigen::Triplet< T > &lhs, const Eigen::Triplet< T > &rhs) |
template<typename T > | |
static bool | compareTripletSecondEntry (const Eigen::Triplet< T > &lhs, const Eigen::Triplet< T > &rhs) |
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) |
template<typename T > | |
static Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > | pinv (const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &a) |
static bool | compareTransformation (const Eigen::MatrixX4f &mDevHeadT, const Eigen::MatrixX4f &mDevHeadTNew, const float &fThreshRot, const float &fThreshTrans) |
Math methods.
ToDo make this a template class Generalized math methods used by mne methods
typedef std::pair<int,int> UTILSLIB::MNEMath::IdxIntValue |
|
inlinevirtual |
|
static |
ToDo make this a template function
mne_combine_xyz
Compute the three Cartesian components of a vector together
[in] | vec | Input row vector [ x1 y1 z1 ... x_n y_n z_n ]. |
Definition at line 81 of file mnemath.cpp.
|
inlinestatic |
|
inlinestatic |
|
static |
Compare new head position with current head position and update dev_head_t if big displacement occured
[in] | mDevHeadTrans | The device to head transformation matrix to compare to. |
[in] | mDevHeadTransNew | The device to head transformation matrix to be compared. |
[in] | fTreshRot | The threshold for big head rotation in degree. |
[in] | fThreshTrans | The threshold for big head movement in m. |
Definition at line 571 of file mnemath.cpp.
|
inlinestatic |
|
inlinestatic |
|
static |
Finds the Greatest Common Divisor (GCD) of two integer values
[in] | a | First input integer. |
[in] | b | Second input integer. |
Definition at line 70 of file mnemath.cpp.
|
static |
Returns the whitener of a given matrix.
[in] | A | Matrix to compute the whitener from. |
[in] | pca | perform a pca. |
|
static |
Returns the whitener of a given matrix.
[in] | A | Matrix to compute the whitener from. |
[in] | pca | perform a pca. |
|
static |
Returns the condition number of a given matrix.
[in] | A | Matrix to compute the condition number from. |
Definition at line 104 of file mnemath.cpp.
|
static |
Returns the condition slope of a given matrix.
[in] | A | Matrix to compute the condition number from. |
Definition at line 117 of file mnemath.cpp.
|
static |
creates a class and frequency distribution from data matrix
[in] | matRawData | raw data matrix that needs to be analyzed. |
[in] | bMakeSymmetrical | user input to turn the x-axis symmetric. |
[in] | iClassCount | user input to determine the amount of classes in the histogram. |
[out] | vecResultClassLimits | the upper limit of each individual class. |
[out] | vecResultFrequency | the amount of data that fits in the appropriate class ranges. |
[in] | dGlobalMin | user input to determine the maximum value allowed in the histogram. |
[in] | dGlobalMax | user input to determine the minimum value allowed in the histogram. |
|
static |
Find the intersection of two vectors
[in] | v1 | Input vector 1. |
[in] | v2 | Input vector 2. |
[out] | idx_sel | Index of intersection based on v1. |
Definition at line 194 of file mnemath.cpp.
|
static |
Determines if a given data (stored as vector v) are representing a sparse matrix. ToDo: status is experimental -> needs to be increased in speed.
[in] | v | data to be tested. |
Definition at line 288 of file mnemath.cpp.
|
static |
LEGENDRE Associated Legendre function.
P = LEGENDRE(N,X) computes the associated Legendre functions of degree N and order M = 0, 1, ..., N, evaluated for each element of X. N must be a scalar integer and X must contain real values between -1 <= X <= 1.
|
static |
LEGENDRE Associated Legendre function.
P = LEGENDRE(N,X) computes the associated Legendre functions of degree N and order M = 0, 1, ..., N, evaluated for each element of X. N must be a scalar integer and X must contain real values between -1 <= X <= 1.
|
inlinestatic |
|
static |
ToDo make this a template function
Make a sparse block diagonal matrix
Returns a sparse block diagonal, diagonalized from the elements in "A". "A" is ma x na, comprising bdn=(na/"n") blocks of submatrices. Each submatrix is ma x "n", and these submatrices are placed down the diagonal of the matrix.
[in,out] | A | Matrix which should be diagonlized. |
[in,out] | n | Columns of the submatrices. |
Definition at line 347 of file mnemath.cpp.
|
static |
Calculates the combination of n over 2 (nchoosek(n,2))
[in] | n | The number of elements which should be combined with each other (n over 2). |
Definition at line 387 of file mnemath.cpp.
|
static |
|
static |
ToDo make this a template function
Returns the rank of a matrix A.
[in] | A | Matrix to get the rank from. |
[in] | tol | realtive threshold: biggest singualr value multiplied with tol is smallest singular value considered non-zero. |
Definition at line 399 of file mnemath.cpp.
|
static |
ToDo: Maybe new processing class
Rescale aka baseline correct data
[in] | data | Data Matrix (m x n_time). |
[in] | times | Time instants is seconds. |
[in] | baseline | If 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 the time point 0 (stimulus onset). |
[in] | mode | Do baseline correction with ratio (power is divided by mean power during baseline) or zscore (power is divided by standard. deviatio of power during baseline after substracting the mean, power = [power - mean(power_baseline)] / std(power_baseline)). ("logratio" | "ratio" | "zscore" | "mean" | "percent") |
|
static |
ToDo: Maybe new processing class
Rescale aka baseline correct data
[in] | data | Data Matrix (m x n_time). |
[in] | times | Time instants is seconds. |
[in] | baseline | If 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 the time point 0 (stimulus onset). |
[in] | mode | Do baseline correction with ratio (power is divided by mean power during baseline) or zscore (power is divided by standard. deviatio of power during baseline after substracting the mean, power = [power - mean(power_baseline)] / std(power_baseline)). ("logratio" | "ratio" | "zscore" | "mean" | "percent") |
|
static |
Sorts a vector (ascending order) in place and returns the track of the original indeces
[in,out] | v | vector to sort; it's sorted in place. |
[in] | desc | if true its sorted in a descending order, otherwise ascending (optional, default = true). |
|
static |
Sorts a vector (ascending order) and a corresponding matrix in place and returns the track of the original indeces The matrix is sorted along the columns using the vector values for comparison.
[in,out] | v_prime | vector to sort (sorted in place). |
[in,out] | mat | matrix to sort (sorted in place). |
[in] | desc | if true its sorted in a descending order, otherwise ascending (optional, default = true). |
|
static |