v2.0.0
Loading...
Searching...
No Matches
numerics.h File Reference

General numerical helpers: GCD, log2, histogram binning, baseline rescaling, sparsity tests. More...

#include "math_global.h"
#include <string>
#include <utility>
#include <vector>
#include <Eigen/Core>
#include <QVariant>
Include dependency graph for numerics.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  UTILSLIB::Numerics
 Static scalar/per-vector numerical helpers (GCD, log2, histograms, baseline rescaling). More...

Namespaces

namespace  UTILSLIB
 Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms).

Detailed Description

General numerical helpers: GCD, log2, histogram binning, baseline rescaling, sparsity tests.

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

UTILSLIB::Numerics groups the scalar / per-vector numerical primitives that almost every other library needs but that have no natural home in Eigen or UTILSLIB::Linalg: the Euclidean GCD, integer log2 and nchoose2 combinatorics used to size connectivity containers, the sparsity heuristic that decides whether a dense vector should be promoted to an Eigen sparse matrix, fixed-width histogram binning over arbitrary ranges, and the rescale routine that applies the standard MNE baseline corrections ("logratio", "ratio", "zscore", "mean", "percent") in-place.

rescale is the most important entry point: it locates the (a, b) baseline window in times via std::lower_bound, computes the per-row baseline summary in O(m*n_b), and applies the chosen transform in O(m*n) with no allocation. The same routine is used by DISP, EVOKED averaging and the source-estimate pipelines so results stay byte-identical regardless of which front-end produced the data.

Definition in file numerics.h.