v2.0.0
Loading...
Searching...
No Matches
MNELIB::MNECovMatrix Class Reference

Covariance matrix storage. More...

#include <mne_cov_matrix.h>

Public Types

typedef QSharedPointer< MNECovMatrixSPtr
typedef QSharedPointer< const MNECovMatrixConstSPtr

Public Member Functions

 MNECovMatrix (int p_kind, int p_ncov, const QStringList &p_names, const Eigen::VectorXd &p_cov, const Eigen::VectorXd &p_cov_diag, FIFFLIB::FiffSparseMatrix *p_cov_sparse)
 ~MNECovMatrix ()
std::unique_ptr< MNECovMatrixdup () const
int is_diag () const
int add_inv ()
int condition (float rank_threshold, int use_rank)
int decompose_eigen_small (float p_small, int use_rank)
int decompose_eigen ()

Static Public Member Functions

static std::unique_ptr< MNECovMatrixcreate_dense (int kind, int ncov, const QStringList &names, const Eigen::VectorXd &cov)
static std::unique_ptr< MNECovMatrixcreate_diag (int kind, int ncov, const QStringList &names, const Eigen::VectorXd &cov_diag)
static std::unique_ptr< MNECovMatrixcreate_sparse (int kind, int ncov, const QStringList &names, FIFFLIB::FiffSparseMatrix *cov_sparse)
static std::unique_ptr< MNECovMatrixcreate (int kind, int ncov, const QStringList &names, const Eigen::VectorXd &cov, const Eigen::VectorXd &cov_diag)

Public Attributes

int kind
int ncov
int nfree
int nproj
int nzero
QStringList names
Eigen::VectorXd cov
Eigen::VectorXd cov_diag
std::unique_ptr< FIFFLIB::FiffSparseMatrixcov_sparse
Eigen::VectorXd lambda
Eigen::VectorXd inv_lambda
Eigen::Matrix< float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > eigen
std::unique_ptr< MNEProjOpproj
std::unique_ptr< MNESssDatasss
Eigen::VectorXi ch_class
QStringList bads
int nbad

Detailed Description

Covariance matrix storage.

Stores a noise or source covariance matrix in dense (packed lower-triangle), diagonal, or sparse form together with its eigendecomposition and associated metadata (projection operator, SSS info, channel classification, bad channels).

Definition at line 104 of file mne_cov_matrix.h.

Member Typedef Documentation

◆ ConstSPtr

typedef QSharedPointer<const MNECovMatrix> MNELIB::MNECovMatrix::ConstSPtr

Const shared pointer type for MNECovMatrix.

Definition at line 108 of file mne_cov_matrix.h.

◆ SPtr

typedef QSharedPointer<MNECovMatrix> MNELIB::MNECovMatrix::SPtr

Shared pointer type for MNECovMatrix.

Definition at line 107 of file mne_cov_matrix.h.

Constructor & Destructor Documentation

◆ MNECovMatrix()

MNECovMatrix::MNECovMatrix ( int p_kind,
int p_ncov,
const QStringList & p_names,
const Eigen::VectorXd & p_cov,
const Eigen::VectorXd & p_cov_diag,
FIFFLIB::FiffSparseMatrix * p_cov_sparse )

Construct a covariance matrix.

Parameters
[in]p_kindCovariance kind (sensor or source).
[in]p_ncovDimension (number of channels).
[in]p_namesChannel names.
[in]p_covPacked lower-triangle data (may be empty).
[in]p_cov_diagDiagonal data (may be empty).
[in]p_cov_sparseSparse covariance data (may be nullptr).

Definition at line 118 of file mne_cov_matrix.cpp.

◆ ~MNECovMatrix()

MNECovMatrix::~MNECovMatrix ( )

Destructor.

Definition at line 141 of file mne_cov_matrix.cpp.

Member Function Documentation

◆ add_inv()

int MNECovMatrix::add_inv ( )

Compute the inverse square-root of eigenvalues (or diagonal elements) for whitening, storing the result in inv_lambda.

Returns
OK on success, FAIL if neither diagonal nor decomposed.

Definition at line 176 of file mne_cov_matrix.cpp.

◆ condition()

int MNECovMatrix::condition ( float rank_threshold,
int use_rank )

Condition the covariance matrix by eigendecomposition with per-channel-type scaling, zeroing sub-threshold eigenvalues, and reconstructing.

Parameters
[in]rank_thresholdEigenvalue threshold ratio for rank estimation.
[in]use_rankIf positive, override the automatic rank estimate.
Returns
The estimated rank, or FAIL on error.

Definition at line 200 of file mne_cov_matrix.cpp.

◆ create()

std::unique_ptr< MNECovMatrix > MNELIB::MNECovMatrix::create ( int kind,
int ncov,
const QStringList & names,
const Eigen::VectorXd & cov,
const Eigen::VectorXd & cov_diag )
inlinestatic

Create a covariance matrix from either dense or diagonal data.

Parameters
[in]kindCovariance kind (sensor or source).
[in]ncovDimension (number of channels).
[in]namesChannel names.
[in]covPacked lower-triangle data (may be empty).
[in]cov_diagDiagonal data (may be empty).
Returns
A new covariance matrix.

Definition at line 207 of file mne_cov_matrix.h.

◆ create_dense()

std::unique_ptr< MNECovMatrix > MNELIB::MNECovMatrix::create_dense ( int kind,
int ncov,
const QStringList & names,
const Eigen::VectorXd & cov )
inlinestatic

Create a dense (full lower-triangle packed) covariance matrix.

Parameters
[in]kindCovariance kind (sensor or source).
[in]ncovDimension (number of channels).
[in]namesChannel names.
[in]covPacked lower-triangle data (length ncov*(ncov+1)/2). Ownership transferred.
Returns
A new covariance matrix.

Definition at line 149 of file mne_cov_matrix.h.

◆ create_diag()

std::unique_ptr< MNECovMatrix > MNELIB::MNECovMatrix::create_diag ( int kind,
int ncov,
const QStringList & names,
const Eigen::VectorXd & cov_diag )
inlinestatic

Create a diagonal covariance matrix.

Parameters
[in]kindCovariance kind (sensor or source).
[in]ncovDimension (number of channels).
[in]namesChannel names.
[in]cov_diagDiagonal data (ncov elements).
Returns
A new covariance matrix.

Definition at line 168 of file mne_cov_matrix.h.

◆ create_sparse()

std::unique_ptr< MNECovMatrix > MNELIB::MNECovMatrix::create_sparse ( int kind,
int ncov,
const QStringList & names,
FIFFLIB::FiffSparseMatrix * cov_sparse )
inlinestatic

Create a sparse covariance matrix.

Parameters
[in]kindCovariance kind (sensor or source).
[in]ncovDimension (number of channels).
[in]namesChannel names.
[in]cov_sparseSparse covariance data (note: data are floats).
Returns
A new covariance matrix.

Definition at line 187 of file mne_cov_matrix.h.

◆ decompose_eigen()

int MNECovMatrix::decompose_eigen ( )

Convenience wrapper for decompose_eigen_small() with default threshold and no rank override.

Returns
OK on success, FAIL on error.

Definition at line 389 of file mne_cov_matrix.cpp.

◆ decompose_eigen_small()

int MNECovMatrix::decompose_eigen_small ( float p_small,
int use_rank )

Perform eigenvalue decomposition of the covariance matrix, zero sub-threshold eigenvalues, classify eigenvectors by channel type, and compute inverse square-roots for whitening.

Parameters
[in]p_smallEigenvalue threshold (negative uses default).
[in]use_rankIf positive, override automatic rank estimate.
Returns
OK on success, FAIL on error.

Definition at line 320 of file mne_cov_matrix.cpp.

◆ dup()

std::unique_ptr< MNECovMatrix > MNECovMatrix::dup ( ) const

Create a deep copy of this covariance matrix including data, channel classes, bad channel list, projection, and SSS info.

Returns
A newly allocated copy.

Definition at line 147 of file mne_cov_matrix.cpp.

◆ is_diag()

int MNECovMatrix::is_diag ( ) const

Check whether this covariance matrix is stored in diagonal form.

Returns
Non-zero if diagonal, zero if full or sparse.

Definition at line 169 of file mne_cov_matrix.cpp.

Member Data Documentation

◆ bads

QStringList MNELIB::MNECovMatrix::bads

Channel names designated bad during computation.

Definition at line 297 of file mne_cov_matrix.h.

◆ ch_class

Eigen::VectorXi MNELIB::MNECovMatrix::ch_class

Per-channel type classification for regularization (MEG grad, MEG mag, EEG).

Definition at line 296 of file mne_cov_matrix.h.

◆ cov

Eigen::VectorXd MNELIB::MNECovMatrix::cov

Packed lower-triangle covariance data (ncov*(ncov+1)/2 elements).

Definition at line 288 of file mne_cov_matrix.h.

◆ cov_diag

Eigen::VectorXd MNELIB::MNECovMatrix::cov_diag

Diagonal covariance data (ncov elements).

Definition at line 289 of file mne_cov_matrix.h.

◆ cov_sparse

std::unique_ptr<FIFFLIB::FiffSparseMatrix> MNELIB::MNECovMatrix::cov_sparse

Sparse covariance matrix (note: data are floats).

Definition at line 290 of file mne_cov_matrix.h.

◆ eigen

Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> MNELIB::MNECovMatrix::eigen

Eigenvectors of the covariance matrix (nzero columns removed).

Definition at line 293 of file mne_cov_matrix.h.

◆ inv_lambda

Eigen::VectorXd MNELIB::MNECovMatrix::inv_lambda

Inverse square-roots of eigenvalues (for whitening).

Definition at line 292 of file mne_cov_matrix.h.

◆ kind

int MNELIB::MNECovMatrix::kind

Covariance kind: sensor or source.

Definition at line 282 of file mne_cov_matrix.h.

◆ lambda

Eigen::VectorXd MNELIB::MNECovMatrix::lambda

Eigenvalues of the covariance matrix.

Definition at line 291 of file mne_cov_matrix.h.

◆ names

QStringList MNELIB::MNECovMatrix::names

Channel names (optional).

Definition at line 287 of file mne_cov_matrix.h.

◆ nbad

int MNELIB::MNECovMatrix::nbad

Number of bad channels.

Definition at line 298 of file mne_cov_matrix.h.

◆ ncov

int MNELIB::MNECovMatrix::ncov

Dimension (number of channels).

Definition at line 283 of file mne_cov_matrix.h.

◆ nfree

int MNELIB::MNECovMatrix::nfree

Number of degrees of freedom used in estimation.

Definition at line 284 of file mne_cov_matrix.h.

◆ nproj

int MNELIB::MNECovMatrix::nproj

Number of dimensions projected out.

Definition at line 285 of file mne_cov_matrix.h.

◆ nzero

int MNELIB::MNECovMatrix::nzero

Number of zero or small eigenvalues.

Definition at line 286 of file mne_cov_matrix.h.

◆ proj

std::unique_ptr<MNEProjOp> MNELIB::MNECovMatrix::proj

The projection operator active when this matrix was computed.

Definition at line 294 of file mne_cov_matrix.h.

◆ sss

std::unique_ptr<MNESssData> MNELIB::MNECovMatrix::sss

SSS data from the associated raw data file.

Definition at line 295 of file mne_cov_matrix.h.


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