v2.0.0
Loading...
Searching...
No Matches
linalg.cpp File Reference

Jacobi-SVD condition metrics, block-diagonal sparse builder and xyz reduction. More...

#include "linalg.h"
#include <Eigen/Eigen>
#include <QDebug>
Include dependency graph for linalg.cpp:

Go to the source code of this file.

Detailed Description

Jacobi-SVD condition metrics, block-diagonal sparse builder and xyz reduction.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors

Author
Christoph Dinh chris.nosp@m.toph.nosp@m..dinh.nosp@m.@mne.nosp@m.-cpp..nosp@m.org
Since
2.0.0
Date
March 2026

Implements the static helpers declared in linalg.h. Conditioning is derived from the singular values returned by Eigen::JacobiSVD: the classical condition number is \(\kappa = \sigma_{max}/\sigma_{min}\), while the condition slope is the least-squares slope of the log-singular-value spectrum, which is a more informative diagnostic for the rapidly decaying spectra typical of MEG/EEG gain matrices.

The block-diagonal builder walks each dense input block once and emits an Eigen::SparseMatrix via setFromTriplets, giving a single O(\sum nnz_k log nnz_k) construction even for the thousands of 3x3 blocks produced by free-orientation source spaces. combine_xyz collapses a row of free-orientation components into per-source squared magnitudes by reusing the same block-diagonal layout.

Definition in file linalg.cpp.