MNENamedMatrix
Namespace: MNELIB · Library: MNE Library
#include <mne/mne_named_matrix.h>
class MNELIB::MNENamedMatrix
A dense matrix with named rows and columns.
MNENamedMatrix associates a dense float matrix (Eigen::MatrixXf) with optional row and column name lists (QStringList). It is the C++ equivalent of the MNE-C mneNamedMatrixRec struct, and is used throughout the library to represent projection vectors, CTF compensation matrices, and forward-solution gain matrices.
The class provides factory methods to:
build() a matrix from its constituent parts,
read() a matrix from a FIFF stream, and
pick() a sub-matrix by selecting named rows and/or columns.
All factory methods return std::unique_ptr<MNENamedMatrix> for clear ownership.
Public Methods
MNENamedMatrix()
Default constructor.
Creates an empty named matrix with zero rows and columns and no associated name lists.
MNENamedMatrix(p_MneNamedMatrix)
Copy constructor.
Performs a deep copy of all members: dimensions, name lists, and matrix data.
Parameters:
- p_MneNamedMatrix : const MNENamedMatrix & The named matrix to copy.
~MNENamedMatrix()
Destructor.
All members (Eigen::MatrixXf, QStringList) are value types and clean themselves up automatically.
pick(pickrowlist, picknrow, pickcollist, pickncol)
Create a sub-matrix by picking named rows and columns.
Selects a subset of this matrix's rows and columns by matching their names against the supplied pick-lists. If a pick-list is empty, all rows (or columns) of the original are retained.
Parameters:
-
pickrowlist : const QStringList & Row names to select (empty = keep all rows).
-
picknrow : int Expected number of picked rows (used when
pickrowlistis empty). -
pickcollist : const QStringList & Column names to select (empty = keep all columns).
-
pickncol : int Expected number of picked columns (used when
pickcollistis empty).
Returns:
- std::unique_ptr< MNENamedMatrix > — A unique pointer to the picked sub-matrix, or
nullptrif a requested name was not found.
Static Methods
build(nrow, ncol, rowlist, collist, data)
Factory: build a named matrix from its constituent parts.
Assembles an MNENamedMatrix from dimension counts, optional row/column name lists, and a dense data matrix.
Parameters:
-
nrow : int Number of rows (must match
data.rows()). -
ncol : int Number of columns (must match
data.cols()). -
rowlist : const QStringList & Name list for the rows (may be empty).
-
collist : const QStringList & Name list for the columns (may be empty).
-
data : const Eigen::MatrixXf & Dense float matrix to store.
Returns:
- std::unique_ptr< MNENamedMatrix > — A unique pointer to the newly created named matrix.
read(stream, node, kind)
Factory: read a named matrix from a FIFF file.
Reads a two-dimensional tagged matrix of the given kind from node (or its first FIFFB_MNE_NAMED_MATRIX child). Row and column name lists are read from the associated FIFF_MNE_ROW_NAMES and FIFF_MNE_COL_NAMES tags when present.
Parameters:
-
stream : QSharedPointer<FiffStream> & Open FIFF stream to read from.
-
node : const QSharedPointer<FiffDirNode> & Directory node that contains (or is) the named-matrix block.
-
kind : int FIFF tag kind that identifies the matrix data (e.g. FIFF_MNE_FORWARD_SOLUTION).
Returns:
- std::unique_ptr< MNENamedMatrix > — A unique pointer to the read matrix, or
nullptron failure.
Authors of this file
- Christoph Dinh <christoph.dinh@mne-cpp.org>