MNE-CPP
beta 1.0
|
Math methods. More...
#include <mnemath.h>
Public Types | |
typedef std::pair< int, int > | IdxIntValue |
Public Member Functions | |
virtual | ~MNEMath () |
Static Public Member Functions | |
static VectorXd * | combine_xyz (const VectorXd &vec) |
static double | getConditionNumber (const MatrixXd &A, VectorXd &s) |
static double | getConditionSlope (const MatrixXd &A, VectorXd &s) |
static void | get_whitener (MatrixXd &A, bool pca, QString ch_type, VectorXd &eig, MatrixXd &eigvec) |
static VectorXi | intersect (const VectorXi &v1, const VectorXi &v2, VectorXi &idx_sel) |
static bool | issparse (VectorXd &v) |
static MatrixXd | legendre (qint32 n, const VectorXd &X, QString normalize=QString("unnorm")) |
static SparseMatrix< double > * | make_block_diag (const MatrixXd &A, qint32 n) |
static int | nchoose2 (int n) |
static qint32 | rank (const MatrixXd &A, double tol=1e-8) |
static MatrixXd | rescale (const MatrixXd &data, const RowVectorXf ×, QPair< QVariant, QVariant > baseline, QString mode) |
template<typename T > | |
static VectorXi | sort (Matrix< T, Dynamic, 1 > &v, bool desc=true) |
template<typename T > | |
static VectorXi | sort (Matrix< T, Dynamic, 1 > &v_prime, Matrix< T, Dynamic, Dynamic > &mat, bool desc=true) |
template<typename T > | |
static std::vector< Triplet< T > > | sortrows (const std::vector< 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 Triplet< T > &lhs, const Triplet< T > &rhs) |
template<typename T > | |
static bool | compareTripletSecondEntry (const Triplet< T > &lhs, const Triplet< T > &rhs) |
template<typename T > | |
static double | log2 (const T d) |
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 79 of file mnemath.cpp.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
static |
Returns the whitener of a given matrix.
[in] | A | Matrix to compute the whitener from |
[in] | pca | perform a pca |
Definition at line 129 of file mnemath.cpp.
|
static |
Returns the condition number of a given matrix.
[in] | A | Matrix to compute the condition number from |
Definition at line 103 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 116 of file mnemath.cpp.
|
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 158 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 255 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.
Definition at line 277 of file mnemath.cpp.
|
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 295 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 335 of file mnemath.cpp.
|
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 348 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 is invalid the beginning of the data is used and if b is invalid then b is set to the end of the interval. If baseline is equal to (invalid, invalid) all the time interval is used. |
[in] | baseline_usage | See description of parameter baseline. |
[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") |
Definition at line 363 of file mnemath.cpp.
|
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 |