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

Go to the source code of this file.
Jacobi-SVD condition metrics, block-diagonal sparse builder and xyz reduction.
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors
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.