v2.0.0
Loading...
Searching...
No Matches
FIFFLIB::FiffSparseMatrix Class Reference

FIFF sparse matrix storage. More...

#include <fiff_sparse_matrix.h>

Public Types

typedef QSharedPointer< FiffSparseMatrixSPtr
typedef QSharedPointer< const FiffSparseMatrixConstSPtr
typedef std::unique_ptr< FiffSparseMatrixUPtr

Public Member Functions

 FiffSparseMatrix ()
 FiffSparseMatrix (const FiffSparseMatrix &mat)=default
 FiffSparseMatrix (FiffSparseMatrix &&mat)=default
FiffSparseMatrixoperator= (const FiffSparseMatrix &)=default
FiffSparseMatrixoperator= (FiffSparseMatrix &&)=default
 ~FiffSparseMatrix ()=default
FiffSparseMatrix::UPtr mne_add_upper_triangle_rcs ()
bool is_empty () const
Eigen::SparseMatrix< double > toEigenSparse () const

Static Public Member Functions

static std::vector< int > fiff_get_matrix_sparse_dims (FIFFLIB::FiffTag::SPtr &tag)
static FiffSparseMatrix::UPtr fiff_get_float_sparse_matrix (FIFFLIB::FiffTag::SPtr &tag)
static FiffSparseMatrix::UPtr create_sparse_rcs (int nrow, int ncol, int *nnz, int **colindex, float **vals)
static FiffSparseMatrix fromEigenSparse (const Eigen::SparseMatrix< double > &mat)

Public Attributes

FIFFLIB::fiff_int_t coding
FIFFLIB::fiff_int_t m
FIFFLIB::fiff_int_t n
FIFFLIB::fiff_int_t nz
Eigen::VectorXf data
Eigen::VectorXi inds
Eigen::VectorXi ptrs

Detailed Description

FIFF sparse matrix storage.

Implements a FIFF sparse matrix.

Definition at line 81 of file fiff_sparse_matrix.h.

Member Typedef Documentation

◆ ConstSPtr

Const shared pointer type for FiffSparseMatrix.

Definition at line 85 of file fiff_sparse_matrix.h.

◆ SPtr

Shared pointer type for FiffSparseMatrix.

Definition at line 84 of file fiff_sparse_matrix.h.

◆ UPtr

Unique pointer type for FiffSparseMatrix.

Definition at line 86 of file fiff_sparse_matrix.h.

Constructor & Destructor Documentation

◆ FiffSparseMatrix() [1/3]

FiffSparseMatrix::FiffSparseMatrix ( )

Constructs the FiffSparseMatrix

Definition at line 144 of file fiff_sparse_matrix.cpp.

◆ FiffSparseMatrix() [2/3]

FIFFLIB::FiffSparseMatrix::FiffSparseMatrix ( const FiffSparseMatrix & mat)
default

Copies a FiffSparseMatrix (default — Eigen vectors handle deep copy).

◆ FiffSparseMatrix() [3/3]

FIFFLIB::FiffSparseMatrix::FiffSparseMatrix ( FiffSparseMatrix && mat)
default

Default move constructor.

◆ ~FiffSparseMatrix()

FIFFLIB::FiffSparseMatrix::~FiffSparseMatrix ( )
default

Destroys the FiffSparseMatrix (default — Eigen vectors clean up automatically).

Member Function Documentation

◆ create_sparse_rcs()

FiffSparseMatrix::UPtr FiffSparseMatrix::create_sparse_rcs ( int nrow,
int ncol,
int * nnz,
int ** colindex,
float ** vals )
static

Create a sparse RCS matrix from row-based data.

Parameters
[in]nrowNumber of rows.
[in]ncolNumber of columns.
[in]nnzNumber of non-zero elements on each row.
[in]colindexColumn indices of non-zero elements on each row.
[in]valsValues of non-zero elements on each row.
Returns
A unique pointer to the newly constructed FiffSparseMatrix, or nullptr on error.

Definition at line 225 of file fiff_sparse_matrix.cpp.

◆ fiff_get_float_sparse_matrix()

FiffSparseMatrix::UPtr FiffSparseMatrix::fiff_get_float_sparse_matrix ( FIFFLIB::FiffTag::SPtr & tag)
static

Conversion of tag data into the standard sparse representation.

Parameters
[in]tagThe tag containing sparse matrix data.
Returns
A unique pointer to the newly constructed FiffSparseMatrix, or nullptr on error.

Definition at line 161 of file fiff_sparse_matrix.cpp.

◆ fiff_get_matrix_sparse_dims()

std::vector< int > FiffSparseMatrix::fiff_get_matrix_sparse_dims ( FIFFLIB::FiffTag::SPtr & tag)
static

Interpret dimensions and nz from matrix data.

Parameters
[in]tagThe tag containing sparse matrix data.
Returns
A vector with the matrix dimension info, or empty on error.

Definition at line 154 of file fiff_sparse_matrix.cpp.

◆ fromEigenSparse()

FiffSparseMatrix FiffSparseMatrix::fromEigenSparse ( const Eigen::SparseMatrix< double > & mat)
static

Create a FiffSparseMatrix from an Eigen::SparseMatrix. Stores in RCS (row-compressed) format.

Parameters
[in]matThe Eigen sparse matrix to convert.
Returns
The equivalent FiffSparseMatrix.

Definition at line 369 of file fiff_sparse_matrix.cpp.

◆ is_empty()

bool FIFFLIB::FiffSparseMatrix::is_empty ( ) const
inline

Check whether this sparse matrix is empty (no non-zero elements).

Returns
true if the matrix has no data.

Definition at line 210 of file fiff_sparse_matrix.h.

◆ mne_add_upper_triangle_rcs()

FiffSparseMatrix::UPtr FiffSparseMatrix::mne_add_upper_triangle_rcs ( )

Add the upper triangle to a lower-triangular sparse RCS matrix.

Returns
A unique pointer to the newly constructed FiffSparseMatrix with both triangles.

Definition at line 273 of file fiff_sparse_matrix.cpp.

◆ operator=() [1/2]

FiffSparseMatrix & FIFFLIB::FiffSparseMatrix::operator= ( const FiffSparseMatrix & )
default

Default copy-assignment operator.

◆ operator=() [2/2]

FiffSparseMatrix & FIFFLIB::FiffSparseMatrix::operator= ( FiffSparseMatrix && )
default

Default move-assignment operator.

◆ toEigenSparse()

Eigen::SparseMatrix< double > FiffSparseMatrix::toEigenSparse ( ) const

Convert this FiffSparseMatrix to an Eigen::SparseMatrix<double>. Supports both RCS and CCS coding.

Returns
The equivalent Eigen sparse matrix.

Definition at line 336 of file fiff_sparse_matrix.cpp.

Member Data Documentation

◆ coding

FIFFLIB::fiff_int_t FIFFLIB::FiffSparseMatrix::coding

coding (storage) type of the sparse matrix.

Definition at line 196 of file fiff_sparse_matrix.h.

◆ data

Eigen::VectorXf FIFFLIB::FiffSparseMatrix::data

Non-zero values (nz elements).

Definition at line 200 of file fiff_sparse_matrix.h.

◆ inds

Eigen::VectorXi FIFFLIB::FiffSparseMatrix::inds

Index array (nz elements).

Definition at line 201 of file fiff_sparse_matrix.h.

◆ m

FIFFLIB::fiff_int_t FIFFLIB::FiffSparseMatrix::m

m rows.

Definition at line 197 of file fiff_sparse_matrix.h.

◆ n

FIFFLIB::fiff_int_t FIFFLIB::FiffSparseMatrix::n

n columns.

Definition at line 198 of file fiff_sparse_matrix.h.

◆ nz

FIFFLIB::fiff_int_t FIFFLIB::FiffSparseMatrix::nz

nz nonzeros.

Definition at line 199 of file fiff_sparse_matrix.h.

◆ ptrs

Eigen::VectorXi FIFFLIB::FiffSparseMatrix::ptrs

Pointer array (m+1 for RCS, n+1 for CCS).

Definition at line 202 of file fiff_sparse_matrix.h.


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