Static linear-algebra helpers: SVD-based conditioning, block-diagonal assembly, sorted index pairs. More...
#include "math_global.h"#include <utility>#include <vector>#include <Eigen/Core>#include <Eigen/SparseCore>#include <Eigen/SVD>#include <QString>

Go to the source code of this file.
Classes | |
| class | UTILSLIB::Linalg |
| Static Eigen-based linear-algebra helpers used across MATHLIB and the inverse solvers. More... | |
Namespaces | |
| namespace | UTILSLIB |
| Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms). | |
Static linear-algebra helpers: SVD-based conditioning, block-diagonal assembly, sorted index pairs.
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors
UTILSLIB::Linalg collects the dense / sparse Eigen primitives that the rest of mne-cpp keeps reaching for but that are not part of Eigen itself: condition number and condition slope from a Jacobi SVD, assembly of block-diagonal sparse matrices from a stack of dense blocks (the typical "three orientations per dipole" layout used by the forward and inverse solvers), the combine_xyz reduction that turns an [x1 y1 z1 ... x_n y_n z_n] row into per-source squared magnitudes, and a stable index-value sort helper used to permute channels or sources by an arbitrary scalar criterion.
All entry points are static and side-effect free so the class never needs to be instantiated. Dense paths run through Eigen::JacobiSVD (O(min(m,n)^2 * max(m,n))) while the sparse paths are linear in the number of stored non-zeros, which keeps the helpers usable even on the source-space-sized matrices manipulated by INVERSELIB.
Definition in file linalg.h.