Covariance matrix storage. More...
#include <mne_cov_matrix.h>
Public Types | |
| typedef QSharedPointer< MNECovMatrix > | SPtr |
| typedef QSharedPointer< const MNECovMatrix > | ConstSPtr |
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< MNECovMatrix > | dup () 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 () |
| int | classify_channels (const QList< FIFFLIB::FiffChInfo > &chs, int nchan) |
| int | whiten_vector (Eigen::Ref< Eigen::VectorXf > data, Eigen::Ref< Eigen::VectorXf > whitened_data, int nchan) const |
| void | regularize (const Eigen::Vector3f ®s) |
| void | revert_to_diag () |
| std::unique_ptr< MNECovMatrix > | pick_chs_omit (const QStringList &new_names, int new_ncov, int omit_meg_eeg, const QList< FIFFLIB::FiffChInfo > &chs) const |
Static Public Member Functions | |
| static std::unique_ptr< MNECovMatrix > | create_dense (int kind, int ncov, const QStringList &names, const Eigen::VectorXd &cov) |
| static std::unique_ptr< MNECovMatrix > | create_diag (int kind, int ncov, const QStringList &names, const Eigen::VectorXd &cov_diag) |
| static std::unique_ptr< MNECovMatrix > | create_sparse (int kind, int ncov, const QStringList &names, FIFFLIB::FiffSparseMatrix *cov_sparse) |
| static std::unique_ptr< MNECovMatrix > | create (int kind, int ncov, const QStringList &names, const Eigen::VectorXd &cov, const Eigen::VectorXd &cov_diag) |
| static std::unique_ptr< MNECovMatrix > | read (const QString &name, int kind) |
| static int | lt_packed_index (int j, int k) |
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::FiffSparseMatrix > | cov_sparse |
| Eigen::VectorXd | lambda |
| Eigen::VectorXd | inv_lambda |
| Eigen::Matrix< float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > | eigen |
| std::unique_ptr< MNEProjOp > | proj |
| std::unique_ptr< MNESssData > | sss |
| Eigen::VectorXi | ch_class |
| QStringList | bads |
| int | nbad |
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 105 of file mne_cov_matrix.h.
| typedef QSharedPointer<const MNECovMatrix> MNELIB::MNECovMatrix::ConstSPtr |
Const shared pointer type for MNECovMatrix.
Definition at line 109 of file mne_cov_matrix.h.
| typedef QSharedPointer<MNECovMatrix> MNELIB::MNECovMatrix::SPtr |
Shared pointer type for MNECovMatrix.
Definition at line 108 of file mne_cov_matrix.h.
| 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.
| [in] | p_kind | Covariance kind (sensor or source). |
| [in] | p_ncov | Dimension (number of channels). |
| [in] | p_names | Channel names. |
| [in] | p_cov | Packed lower-triangle data (may be empty). |
| [in] | p_cov_diag | Diagonal data (may be empty). |
| [in] | p_cov_sparse | Sparse covariance data (may be nullptr). |
Definition at line 124 of file mne_cov_matrix.cpp.
| MNECovMatrix::~MNECovMatrix | ( | ) |
Destructor.
Definition at line 147 of file mne_cov_matrix.cpp.
| int MNECovMatrix::add_inv | ( | ) |
Compute the inverse square-root of eigenvalues (or diagonal elements) for whitening, storing the result in inv_lambda.
Definition at line 393 of file mne_cov_matrix.cpp.
| int MNECovMatrix::classify_channels | ( | const QList< FIFFLIB::FiffChInfo > & | chs, |
| int | nchan ) |
Assign channel-type classifications (MEG mag, MEG grad, EEG) to channels in this covariance matrix, based on channel information.
| [in] | chs | Channel information list. |
| [in] | nchan | Number of channels in chs. |
Definition at line 625 of file mne_cov_matrix.cpp.
| 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.
| [in] | rank_threshold | Eigenvalue threshold ratio for rank estimation. |
| [in] | use_rank | If positive, override the automatic rank estimate. |
Definition at line 417 of file mne_cov_matrix.cpp.
|
inlinestatic |
Create a covariance matrix from either dense or diagonal data.
| [in] | kind | Covariance kind (sensor or source). |
| [in] | ncov | Dimension (number of channels). |
| [in] | names | Channel names. |
| [in] | cov | Packed lower-triangle data (may be empty). |
| [in] | cov_diag | Diagonal data (may be empty). |
Definition at line 208 of file mne_cov_matrix.h.
|
inlinestatic |
Create a dense (full lower-triangle packed) covariance matrix.
| [in] | kind | Covariance kind (sensor or source). |
| [in] | ncov | Dimension (number of channels). |
| [in] | names | Channel names. |
| [in] | cov | Packed lower-triangle data (length ncov*(ncov+1)/2). Ownership transferred. |
Definition at line 150 of file mne_cov_matrix.h.
|
inlinestatic |
|
inlinestatic |
Create a sparse covariance matrix.
| [in] | kind | Covariance kind (sensor or source). |
| [in] | ncov | Dimension (number of channels). |
| [in] | names | Channel names. |
| [in] | cov_sparse | Sparse covariance data (note: data are floats). |
Definition at line 188 of file mne_cov_matrix.h.
| int MNECovMatrix::decompose_eigen | ( | ) |
Convenience wrapper for decompose_eigen_small() with default threshold and no rank override.
Definition at line 606 of file mne_cov_matrix.cpp.
| 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.
| [in] | p_small | Eigenvalue threshold (negative uses default). |
| [in] | use_rank | If positive, override automatic rank estimate. |
Definition at line 537 of file mne_cov_matrix.cpp.
| 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.
Definition at line 364 of file mne_cov_matrix.cpp.
| int MNECovMatrix::is_diag | ( | ) | const |
Check whether this covariance matrix is stored in diagonal form.
Definition at line 386 of file mne_cov_matrix.cpp.
|
static |
Compute the linear index into a symmetric lower-triangular packed storage array for element (j, k).
| [in] | j | Row index. |
| [in] | k | Column index. |
Definition at line 614 of file mne_cov_matrix.cpp.
| std::unique_ptr< MNECovMatrix > MNECovMatrix::pick_chs_omit | ( | const QStringList & | new_names, |
| int | new_ncov, | ||
| int | omit_meg_eeg, | ||
| const QList< FIFFLIB::FiffChInfo > & | chs ) const |
Pick designated channels from this covariance matrix, optionally omitting MEG-EEG cross-correlations.
| [in] | new_names | Names of channels to pick. |
| [in] | new_ncov | Number of channels to pick. |
| [in] | omit_meg_eeg | If non-zero, zero out MEG-EEG cross entries. |
| [in] | chs | Channel information list (for MEG/EEG classification). |
Definition at line 743 of file mne_cov_matrix.cpp.
|
static |
Read a covariance matrix of the specified kind from a FIFF file.
| [in] | name | Path to the FIFF file. |
| [in] | kind | Covariance kind (e.g. FIFFV_MNE_SENSOR_COV). |
Definition at line 153 of file mne_cov_matrix.cpp.
| void MNECovMatrix::regularize | ( | const Eigen::Vector3f & | regs | ) |
Regularize different channel types of the covariance matrix by adding a fraction of the average diagonal value for each channel class.
| [in] | regs | Regularization fractions for [MEG_MAG, MEG_GRAD, EEG]. |
Definition at line 682 of file mne_cov_matrix.cpp.
| void MNECovMatrix::revert_to_diag | ( | ) |
Revert a full (lower-triangle packed) covariance matrix to its diagonal elements, discarding off-diagonal data and eigendecomposition.
Definition at line 723 of file mne_cov_matrix.cpp.
| int MNECovMatrix::whiten_vector | ( | Eigen::Ref< Eigen::VectorXf > | data, |
| Eigen::Ref< Eigen::VectorXf > | whitened_data, | ||
| int | nchan ) const |
Apply whitening to a data vector using the inverse square-root eigenvalues stored in this covariance matrix.
| [in] | data | Input data vector. |
| [out] | whitened_data | Whitened output vector (may alias data for in-place). |
| [in] | nchan | Number of channels. |
Definition at line 657 of file mne_cov_matrix.cpp.
| QStringList MNELIB::MNECovMatrix::bads |
Channel names designated bad during computation.
Definition at line 364 of file mne_cov_matrix.h.
| Eigen::VectorXi MNELIB::MNECovMatrix::ch_class |
Per-channel type classification for regularization (MEG grad, MEG mag, EEG).
Definition at line 363 of file mne_cov_matrix.h.
| Eigen::VectorXd MNELIB::MNECovMatrix::cov |
Packed lower-triangle covariance data (ncov*(ncov+1)/2 elements).
Definition at line 355 of file mne_cov_matrix.h.
| Eigen::VectorXd MNELIB::MNECovMatrix::cov_diag |
Diagonal covariance data (ncov elements).
Definition at line 356 of file mne_cov_matrix.h.
| std::unique_ptr<FIFFLIB::FiffSparseMatrix> MNELIB::MNECovMatrix::cov_sparse |
Sparse covariance matrix (note: data are floats).
Definition at line 357 of file mne_cov_matrix.h.
| Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> MNELIB::MNECovMatrix::eigen |
Eigenvectors of the covariance matrix (nzero columns removed).
Definition at line 360 of file mne_cov_matrix.h.
| Eigen::VectorXd MNELIB::MNECovMatrix::inv_lambda |
Inverse square-roots of eigenvalues (for whitening).
Definition at line 359 of file mne_cov_matrix.h.
| int MNELIB::MNECovMatrix::kind |
Covariance kind: sensor or source.
Definition at line 349 of file mne_cov_matrix.h.
| Eigen::VectorXd MNELIB::MNECovMatrix::lambda |
Eigenvalues of the covariance matrix.
Definition at line 358 of file mne_cov_matrix.h.
| QStringList MNELIB::MNECovMatrix::names |
Channel names (optional).
Definition at line 354 of file mne_cov_matrix.h.
| int MNELIB::MNECovMatrix::nbad |
Number of bad channels.
Definition at line 365 of file mne_cov_matrix.h.
| int MNELIB::MNECovMatrix::ncov |
Dimension (number of channels).
Definition at line 350 of file mne_cov_matrix.h.
| int MNELIB::MNECovMatrix::nfree |
Number of degrees of freedom used in estimation.
Definition at line 351 of file mne_cov_matrix.h.
| int MNELIB::MNECovMatrix::nproj |
Number of dimensions projected out.
Definition at line 352 of file mne_cov_matrix.h.
| int MNELIB::MNECovMatrix::nzero |
Number of zero or small eigenvalues.
Definition at line 353 of file mne_cov_matrix.h.
| std::unique_ptr<MNEProjOp> MNELIB::MNECovMatrix::proj |
The projection operator active when this matrix was computed.
Definition at line 361 of file mne_cov_matrix.h.
| std::unique_ptr<MNESssData> MNELIB::MNECovMatrix::sss |
SSS data from the associated raw data file.
Definition at line 362 of file mne_cov_matrix.h.