Skip to content

Capability index

Every public name in gaussx (366 of them), grouped as the API reference groups it, with the first line of its docstring; then the public API of the libraries gaussx builds on, and the private toolkits gaussx's own modules share. Search this page before writing a helper: if what you need is here, compose it; if it is almost here, extend it where it lives. Regenerate with make capabilities after changing a public API (tests/test_capabilities.py checks it is current).

Primitives

Solve, logdet & Cholesky

Name Kind What it does
solve function Solve A x = b with structural dispatch.
logdet function Compute log |det(A)| with structural dispatch.
cholesky function Compute Cholesky factor L such that A = L L^T.
cholesky_logdet function Compute log|A| from Cholesky factor L where A = L Lᵀ.

Pseudo-determinant

Name Kind What it does
pseudo_logdet function Log pseudo-determinant: the log of the product of the non-zero eigenvalues.

Trace & diagonal

Name Kind What it does
trace function Compute the trace of an operator.
diag function Extract the diagonal of an operator as a 1D array.
trace_and_diag function Jointly estimate the trace and diagonal from one probe pass.

Inverse, square root & spectral decompositions

Name Kind What it does
inv function Return a lazy inverse operator A^{-1}.
sqrt function Compute matrix square root S such that S @ S = A.
eig function Compute eigenvalues and eigenvectors.
eigvals function Compute eigenvalues only.
svd function Compute the singular value decomposition A = U diag(s) V^T.
frobenius_norm function Compute the Frobenius norm \|\|A\|\|_F with structural dispatch.
submatrix function Extract A[row_idx, col_idx] without forming the full matrix.

Generalised eigenproblems

Name Kind What it does
eigh_generalized function Solve \(A v = \lambda B v\) for symmetric \(A\) and symmetric PSD \(B\).

Matrix-free square-root products

Name Kind What it does
sqrt_matmul function Compute \(A^{1/2} b\) via contour-integral quadrature.
sqrt_inv_matmul function Compute \(A^{-1/2} b\) via contour-integral quadrature.
estimate_spectral_bounds function Estimate \((\lambda_{\min}, \lambda_{\max})\) of a symmetric operator.

Joint inverse-quadratic and log-determinant

Name Kind What it does
inv_quad_logdet function Joint inverse-quadratic and log-determinant via shared BBMM CG.

Root decompositions

Name Kind What it does
root_decomposition function Compute a tall factor R such that R Rᵀ ≈ A.
root_inv_decomposition function Compute a tall factor R⁻ such that R⁻ (R⁻)ᵀ ≈ A⁻¹.
RootDecomposition class Tall factor R with R Rᵀ ≈ A semantics.

Quantiles

Name Kind What it does
mixture_quantile function Invert a CDF at one or more quantile levels by bracketed root finding.
mixture_quantile_gaussian_approx function Quantiles of the Gaussian matched to an ensemble's first two moments.
Chandrupatla class Chandrupatla's hybrid inverse-quadratic / bisection root finder.

Support types

Name Kind What it does
DenseFallbackWarning class Warning emitted when a structured primitive materialises an operator.

Operators & Tags

Structured products & sums

Name Kind What it does
Kronecker class Kronecker product operator A₁ ⊗ A₂ ⊗ … ⊗ Aₖ.
BlockDiag class Block diagonal operator diag(A₁, A₂, …, Aₖ).
KroneckerSum class Kronecker sum A \oplus B = A \otimes I_b + I_a \otimes B.
KroneckerSumSqrt class Symmetric square root of A \oplus B via per-factor eigenvectors.
SumOfKroneckers class Sum of Kronecker products Σ_k A_k \otimes B_k.
SumOfKroneckersSqrt class Lazy Lanczos square-root operator for SumOfKroneckers covariances.

Low-rank updates

Name Kind What it does
LowRankUpdate class Low-rank update operator L + U diag(d) Vᵀ.
low_rank_plus_diag function Construct diag(diag) + U diag(d) Vᵀ.
low_rank_plus_identity function Construct scale * I + U diag(d) Vᵀ.
svd_low_rank_plus_diag function Construct diag(diag) + U diag(S) Vᵀ from a truncated SVD.

Banded & Toeplitz

Name Kind What it does
BlockTriDiag class Block-tridiagonal operator with a symmetric off-diagonal band.
LowerBlockTriDiag class Lower triangular block-bidiagonal Cholesky factor.
UpperBlockTriDiag class Upper triangular block-bidiagonal (transpose of LowerBlockTriDiag).
Toeplitz class Symmetric Toeplitz matrix from its first column.
ToeplitzCholesky class Circulant-embedding sample factor for a symmetric positive Toeplitz matrix.

Fast-diagonalisable operators

Name Kind What it does
DiagonalizedOperator class Linear operator A x = V⁻¹(Λ ⊙ V x) given by a transform pair.
circulant function (Block-)circulant operator from its first column.
circulant_from_symbol function (Block-)circulant operator from its DFT symbol.
as_diagonalized function Express operator as one DiagonalizedOperator, if possible.
SpectralFunction class f(B) for a symmetric B with a factored eigenbasis.

Interpolated & masked operators

Name Kind What it does
InterpolatedOperator class Structured Kernel Interpolation: K \approx W K_{uu} W^T.
MaskedOperator class Row/column-masked view of a base operator.
grid_coupling_indices function Flat indices of masked-out grid cells adjacent to the masked-in region.
create_grid function Create a regular grid from per-dimension sizes and bounds.
grid_data function Expand a grid to the full Cartesian product of grid points.
cubic_interpolation_weights function Compute cubic interpolation indices and weights for SKI.

Lazy algebra & sampling

Name Kind What it does
sum_operator function Lazy sum (A + B + …) v = A v + B v + ….
scaled_operator function Lazy scalar multiply (c A) v = c (A v).
product_operator function Lazy matmul (A B) v = A (B v).
kronecker_sum_sample function Sample from 𝒩(0, A ⊕ B) using per-factor eigendecompositions.
sum_of_kroneckers_sample function Sample from 𝒩(0, op) with matrix-free Lanczos square roots.
toeplitz_sample function Sample from 𝒩(0, Toeplitz(column)) via FFT circulant embedding.
CapacitanceSolver class Solve a base system subject to homogeneous point constraints.

Structural tags & predicates

Name Kind What it does
is_kronecker function Check whether operator carries the Kronecker tag.
is_kronecker_sum function Check whether operator carries the Kronecker sum tag.
is_block_diagonal function Check whether operator carries the block-diagonal tag.
is_block_tridiagonal function Check whether operator carries the block-tridiagonal tag.
is_low_rank function Check whether operator carries the low-rank tag.
is_eigen_reducible function Whether a sum of Kronecker products has the exact two-term reduction.
is_diagonal function Re-exported from lineax.
is_symmetric function Re-exported from lineax.
is_positive_semidefinite function Re-exported from lineax.
is_negative_semidefinite function Re-exported from lineax.
is_lower_triangular function Re-exported from lineax.
is_upper_triangular function Re-exported from lineax.
kronecker_tag constant Operator is a Kronecker product.
kronecker_sum_tag constant Operator is a Kronecker sum A (+) B = A (x) I_b + I_a (x) B.
block_diagonal_tag constant Operator is block diagonal.
block_tridiagonal_tag constant Operator is block tridiagonal.
low_rank_tag constant Operator has low-rank structure (e.g. L + U D V^T).
diagonal_tag constant Re-exported from lineax.
symmetric_tag constant Re-exported from lineax.
positive_semidefinite_tag constant Re-exported from lineax.
negative_semidefinite_tag constant Re-exported from lineax.
lower_triangular_tag constant Re-exported from lineax.
upper_triangular_tag constant Re-exported from lineax.
tridiagonal_tag constant Re-exported from lineax.
unit_diagonal_tag constant Re-exported from lineax.

Deprecated aliases

Name Kind What it does
SumKronecker class Deprecated alias for SumOfKroneckers.
SumKroneckerSqrt class Deprecated alias for SumOfKroneckersSqrt (gh-297).
sumkronecker_sample function Deprecated alias for sum_of_kroneckers_sample (gh-297).
SVDLowRankUpdate class Deprecated subclass of LowRankUpdate with orthonormal=True.

Sparse Operators

Sparse Cholesky

Name Kind What it does
SparseOperator class Sparse matrix with a static SparsityPattern and traced values.
SparsityPattern class Static, hashable sparsity pattern of a (m, n) matrix.
symbolic_cholesky function Symbolic analysis of a sparse Cholesky factorisation (host, cached).
SymbolicCholesky class Symbolic Cholesky factor of a symmetric sparsity pattern.
sparse_cholesky function Sparse Cholesky factorisation of a symmetric positive-definite operator.
SparseCholeskyFactor class Sparse Cholesky factor P Q Pᵀ = L Lᵀ on a static symbolic pattern.

GMRF Precision Builders

Name Kind What it does
iid_precision function Precision τ I of n independent effects with variance 1/τ.
rw1_structure function Structure matrix R = D₁ᵀ W D₁ of a first-order random walk.
rw2_structure function Structure matrix R = D₂ᵀ D₂ of a second-order random walk.
ar1_precision function Precision of a stationary AR(1) process with marginal precision τ.
besag_structure function Validate a graph Laplacian as a Besag (ICAR) structure matrix.
generalized_variance_scale function Generalized variance of an intrinsic GMRF (Sørbye & Rue, 2014).
bym2_precision function Joint precision of the BYM2 pair (b, u*) (Riebler et al., 2016).
spde_precision function SPDE precision Q_α = τ² K (C̃⁻¹K)^{α−1} with K = κ²C̃ + G.
spde_precision_grid function SPDE precision on a regular grid: a function of a Kronecker sum.
matern_spde_params function SPDE parameters (κ, τ, α) of a Matérn field.
fem_matrices function Lumped mass C̃ and stiffness G of P1 elements on a triangle mesh.
fem_projector function Observation matrix A of P1 interpolation: (A w)_k = Σ_i ψ_i(s_k) w_i.

Solvers & Preconditioners

The front door

Name Kind What it does
linear_solve function Solve A x = b through the unified front door.
as_linear_operator function Wrap a raw matvec callable as a tagged lineax operator.

Abstract interfaces

Name Kind What it does
AbstractSolveStrategy class Protocol for linear solve strategies.
AbstractLogdetStrategy class Protocol for log-determinant strategies.
AbstractSolverStrategy class Protocol for solver strategies that pair solve + logdet.

Direct & iterative solvers

Name Kind What it does
DenseSolver class Dense solver strategy using gaussx structural dispatch.
AutoSolver class Automatic solver selection based on operator type and size.
CGSolver class Iterative CG solver with stochastic log-determinant.
PreconditionedCGSolver class CG solver with pivoted partial Cholesky preconditioner.
MINRESSolver class MINRES solver for symmetric (possibly indefinite) systems.
LSMRSolver class LSMR iterative least-squares solver (Fong & Saunders 2011).
BBMMSolver class CG solve and SLQ logdet with BBMM's defaults (Gardner et al. 2018).
ComposedSolver class Mix-and-match solve and logdet from different strategies.
KeyedSolver class Bind a PRNG key to a strategy's stochastic log-determinant (gh-384).
LineaxSolver class A lineax solver as a gaussx solve strategy.
SparseCholeskySolver class Exact solve / logdet / diag_inv through a sparse Cholesky factor.

Sketch-and-precondition least squares

Name Kind What it does
SketchAndPrecondLSMR class Sketch-and-precondition LSMR for tall least squares (Rokhlin & Tygert, 2008).
sketch_and_solve function Approximate least squares from a sketch.

Logdet strategies

Name Kind What it does
DenseLogdet class Dense log-determinant via gaussx structural dispatch.
SLQLogdet class Stochastic log-determinant via Lanczos quadrature (SLQ).
IndefiniteSLQLogdet class Stochastic log\|det(A)\| for symmetric (possibly indefinite) operators.
NystromLogdet class Nyström-preconditioned log-determinant of \(A + \mu I\) (Wenger et al., 2022).

Preconditioners

Name Kind What it does
AbstractPreconditioner class Protocol for preconditioners producing an approximate inverse.
JacobiPreconditioner class Diagonal preconditioner M^{-1} = diag(1 / \|diag(A)\|).
OperatorPreconditioner class Use an externally supplied approximate inverse as a preconditioner.
NystromPreconditioner class Randomized Nyström preconditioner for A + μ I.
PartialCholeskyPreconditioner class Preconditioner from a pivoted partial Cholesky factor.

Linear-Algebra Utilities

Robust factorization & hygiene

Name Kind What it does
safe_cholesky function Cholesky decomposition with adaptive jitter for near-singular matrices.
symmetrize function Symmetrize the trailing two axes: 0.5 * (X + X^T).

Matrix identities

Name Kind What it does
woodbury_solve function Standalone Woodbury identity solve: (L + U diag(D) U^T)^{-1} b.
schur_complement function Schur complement: K_XX - K_XZ @ K_ZZ^{-1} @ K_ZX.
conditional_variance function Predictive variance: Schur complement diagonal plus optional variational correction.
diag_conditional_variance function Diagonal of Schur complement: diag(K_XX - A K_ZX).
cov_transform function Covariance propagation through a linear map: J @ Sigma @ J^T.
sandwich function Return A @ P @ A.T exploiting compatible operator structure.
trace_product function Trace of a matrix product: tr(A @ B) with structural dispatch.

Marginal variances & selected inverses

Name Kind What it does
diag_inv function Compute the diagonal of the inverse of a linear operator.
selected_inverse function The band of Σ = Q⁻¹ for a symmetric positive-definite BlockTriDiag.

Matrix-RHS & batched solves

Name Kind What it does
solve_matrix function Solve A X = B with a single factorization on the matrix RHS.
solve_columns function Solve A X = B column-by-column via vmap.
solve_rows function Solve A x = bᵢ for each row bᵢ of a matrix via vmap.
tridiagonal_solve function Solve a tridiagonal system A x = d.
tridiagonal_solve_batched function Solve independent tridiagonal systems over leading batch dimensions.

Matrix diagonalization & shifted Kronecker-sum solves

Name Kind What it does
EigenDecomposition class Precomputed eigendecomposition A = V diag(λ) V⁻¹ of a square matrix.
kronecker_sum_solve function Solve a shifted Kronecker-sum system in tensor (unvectorized) form.

Stable distances & Lyapunov

Name Kind What it does
stable_squared_distances function Squared Euclidean distances with mixed-precision stability.
discrete_lyapunov_solve function Solve the discrete Lyapunov equation P - G P G^T = Q.

Sketching

Abstract interface

Name Kind What it does
AbstractSketch class A random sketching matrix \(S \in \mathbb{R}^{d \times m}\), sampled once.

Sketches

Name Kind What it does
GaussianSketch class Gaussian sketch: i.i.d. entries \(S_{ij} \sim \mathcal{N}(0, 1/d)\).
OrthonormalSketch class Gaussian sketch with orthonormal rows, \(S S^\top = I_d\).
SparseSignSketch class Sparse sign sketch (sparse Johnson-Lindenstrauss transform).
SRHTSketch class Subsampled randomized Hadamard transform sketch.
RowSamplingSketch class Weighted row-sampling sketch.

Fast transforms

Name Kind What it does
hadamard_transform function Unnormalized Walsh-Hadamard transform along the last axis.

Randomized Linear Algebra

Range finder, QB, SVD and eigh

Name Kind What it does
range_finder function Orthonormal basis \(Q\) for the dominant range of \(A\).
qb function Randomized QB factorisation \(A \approx QB\) with \(B = Q^\top A\).
randomized_svd function Truncated SVD \(A \approx U \operatorname{diag}(s) V^\top\) by randomized QB.
randomized_eigh function Partial eigendecomposition of a symmetric operator by Rayleigh-Ritz.

Randomized Nyström

Name Kind What it does
randomized_nystrom function Randomized Nyström approximation \(\hat A = U\hat\Lambda U^\top\) of a PSD \(A\).

Randomly pivoted Cholesky

Name Kind What it does
rp_cholesky function Randomly pivoted partial Cholesky of a PSD matrix A.

Interpolative and CUR decompositions

Name Kind What it does
column_id function Randomized column interpolative decomposition (Voronin & Martinsson, 2017).
cur function Randomized CUR decomposition (Voronin & Martinsson, 2017, §4).
ColumnID class Column interpolative decomposition \(A \approx A_{:,J}\,X\).
CUR class CUR decomposition \(A \approx C\,U\,R\), \(C = A_{:,J}\), \(R = A_{I,:}\).

Distributions & Exponential Family

Multivariate normal distributions

Name Kind What it does
AbstractMultivariateNormal class Common surface of MultivariateNormal and MultivariateNormalPrecision.
MultivariateNormal class Multivariate normal parameterized by a lineax linear operator.
MultivariateNormalPrecision class Multivariate normal parameterized by a precision (inverse covariance) operator.

Gaussian Markov random fields

Name Kind What it does
GaussianMRF class Gaussian Markov random field \(x \sim \mathcal N(\mu, Q^{-1})\).
IntrinsicGMRF class Improper \(\mathcal N(\mu, (\tau R)^+)\) on the complement of \(\ker R\).
ConstrainedGMRF class A GaussianMRF conditioned on hard linear constraints \(A_cx = e\).
BYM2GMRF class The BYM2 pair \((b, u^\ast)\) (Riebler et al., 2016), with its exact density.

Sequential distributions

Name Kind What it does
LGSSM class Linear-Gaussian state-space model as a density over (T, M).
MaskedLGSSM class LGSSM whose log_prob marginalises unobserved channels exactly.
LGSSMFactory class Callable obs_mask -> MaskedLGSSM, for conditional use.
MarkovGaussian class Chain-Markov Gaussian over \(x_{0:T-1}\) as a density over (T, d).

Gaussian sugar ops

Name Kind What it does
gaussian_log_prob function Multivariate normal log-probability.
gaussian_entropy function Entropy of a multivariate normal N(mu, Sigma).
quadratic_form function Compute x^T A^{-1} x via a single solve.
kl_standard_normal function KL(first ‖ second): KL(N(m, S) \|\| N(0, I)).
gaussian_kl function KL(first ‖ second): KL(p \|\| q) between two multivariate normals.
conditional function Compute p(x_A \| x_B = b) from a joint Gaussian p(x_A, x_B).
joseph_update function Numerically stable Joseph-form covariance update.
add_jitter function Add diagonal jitter for numerical stability: A + eps * I.
project function Compute A_X = K_XZ @ K_ZZ^{-1} via Cholesky solve.

Structured sampling

Name Kind What it does
sample_mvn function Draw samples from \(\mathcal{N}(\mu, K)\), dispatching on \(K\)'s structure.
sample_joint_conditional function Joint draws of a partitioned Gaussian, and conditional draws from them.

Exponential family

Name Kind What it does
GaussianExpFam class Gaussian in natural (exponential family) parameters.
to_mean_cov function Convert natural parameters to the mean and covariance.
mean_cov_to_natural function Convert mean/covariance to natural parameters (operator form).
natural_to_mean_cov function Convert natural parameters to mean/covariance (operator form).
mean_chol_to_natural function Convert mean/variance (Cholesky) to natural parameters.
natural_to_mean_chol function Convert natural parameters to mean/variance (Cholesky).
mean_chol_to_expectation function Convert mean/variance (Cholesky) to expectation parameters.
expectation_to_mean_chol function Convert expectation parameters to mean/variance (Cholesky).
expectation_to_natural function Convert expectation parameters to natural parameters.
natural_to_expectation function Convert natural parameters to expectation parameters.
log_partition function Log-partition function A(eta).
fisher_info function Fisher information with respect to the mean, \(F_\mu = \Sigma^{-1}\).
sufficient_stats function Compute sufficient statistics T(x) = [x, x x^T].
kl_divergence function KL(first ‖ second): KL(q \|\| p) via the Bregman form on natural parameters.

Deprecated aliases

Name Kind What it does
to_natural function Deprecated alias of gaussx.mean_cov_to_natural.
to_expectation function Deprecated alias of to_mean_cov.

Gaussian Processes

Conditioning & prediction

Name Kind What it does
sparse_conditional function Sparse-GP conditional q(f_x) = \int p(f_x \| u) q(u) du.
build_prediction_cache function Solve K_y alpha = y and cache the result.
PredictionCache class Cached training solve (and factor) for amortized predictions.
predict_mean function Predictive mean: mu* = K_*f @ alpha.
predict_variance function Predictive variance sigma^2_* = k_** - diag(K_*f K_y^{-1} K_f*).
conditional_interpolate function Two-filter fusion at t from a filtered state and a backward message.
rts_interpolate function Smoothed marginal at an unobserved t from filtered and smoothed states.
kronecker_posterior_predictive function Posterior mean and variance for a Kronecker GP at test points.
kronecker_mll function Exact marginal log-likelihood for a Kronecker-structured GP.

Pathwise sampling

Name Kind What it does
matheron_update function Posterior samples via Matheron's-rule correction.

Whitening

Name Kind What it does
unwhiten function Unwhiten variational mean: m = L @ m_tilde.
unwhiten_covariance function Unwhiten variational covariance: S = L S̃ Lᵀ.
whiten_covariance function Unwhiten variational covariance: S = L S̃ Lᵀ.
whitened_svgp_predict function Whitened SVGP prediction: mean and variance at test points.
svgp_variance_adjustment function Compute the SVGP variance adjustment operator.

Variational bounds & KL

Name Kind What it does
variational_elbo_gaussian function Uncollapsed (SVGP) ELBO for a Gaussian likelihood.
variational_elbo_mc function Monte Carlo ELBO for non-conjugate likelihoods.
collapsed_elbo function Collapsed ELBO (Titsias bound) for sparse GP regression.
gauss_kl function KL(first ‖ second): KL[q(u) \|\| p(u)] with p(u) = N(0, K).

Cross-validation & diagnostics

Name Kind What it does
love_cache function Precompute a Lanczos approximation of K^{-1} for fast variance.
love_variance function Approximate k_*^\top K^{-1} k_* from a LOVE cache.
love_residual function Relative solve residual of a LOVE cache for one cross-covariance.
love_variance_error_bound function Upper bound on the variance over-estimate of a LOVE cache.
LOVECache class Cached rank-k Lanczos approximation of K^{-1}.
leave_one_out_cv function LOO-CV via the bordered-system identity.
LOOResult class Result of leave-one-out cross-validation.

Multi-output projections

Name Kind What it does
oilmm_project function Project multi-output data to independent latent GPs via OILMM.
oilmm_back_project function Back-project latent GP predictions to the observation space.

Deprecated aliases

Name Kind What it does
base_conditional function Deprecated: use sparse_conditional (note K_xz = K_mn.T).

Quadrature & Moment Matching

State & integrators

Name Kind What it does
GaussianState class Gaussian distribution as (mean, covariance operator) pair.
PropagationResult class Output of uncertainty propagation through a nonlinear function.
AbstractIntegrator class Protocol for Gaussian integral approximation.
moment_transform function Moment triple of (x, fn(x)) for x Gaussian.
GaussHermiteIntegrator class Gauss-Hermite quadrature integrator.
UnscentedIntegrator class Unscented transform: deterministic sigma points.
CubatureIntegrator class Third-order spherical-radial cubature.
FifthOrderCubatureIntegrator class Fifth-order fully symmetric cubature (McNamee & Stenger).
TaylorIntegrator class 1st or 2nd order Taylor expansion for uncertainty propagation.
MonteCarloIntegrator class Monte Carlo moment matching: sample, propagate, compute moments.
AssumedDensityFilter class KL-optimal Gaussian projection via moment matching.

Quadrature rules

Name Kind What it does
gauss_hermite_points function Gauss-Hermite quadrature points and weights.
cubature_points function Spherical-radial cubature points and weights.
fifth_order_cubature_points function Fifth-order fully symmetric cubature points and weights.
sigma_points function Unscented transform sigma points and weights.

Likelihoods

Name Kind What it does
AbstractLikelihood class Base class for likelihood functions with optional analytical ELL.
GaussianLikelihood class Gaussian likelihood log N(y \| f, noise_var * I).
HeteroscedasticGaussianLikelihood class Heteroscedastic Gaussian likelihood with input-dependent noise.
BernoulliLikelihood class Bernoulli likelihood with logit link.
BinomialLikelihood class Binomial likelihood with logit link.
PoissonLikelihood class Poisson likelihood with log link.
NegativeBinomialLikelihood class Negative-binomial likelihood with log link (NB2, a gamma-Poisson mixture).
SoftmaxLikelihood class Softmax (categorical) likelihood for multi-class classification.
StudentTLikelihood class Student-t likelihood for robust regression.

Expectations & EP moments

Name Kind What it does
elbo function Evidence lower bound (ELBO).
expected_log_likelihood function Unified expected log-likelihood with analytical dispatch.
log_likelihood_expectation function Compute E[log p(y_{obs} \| f(x))] where x ~ N(mu, Sigma).
mean_expectation function Compute E[f(x)] where x ~ N(mu, Sigma).
gradient_expectation function Compute E[nabla f(x)] via Stein's lemma.
cost_expectation function Compute E[Cost(f(x), target)] where x ~ N(mu, Sigma).
ep_tilted_moments function Moments of the scalar EP tilted distribution, elementwise over a batch.

Moment matching & linearisation

Name Kind What it does
moment_match function EP moment matching: tilted log-normaliser and its first two derivatives.
MomentMatchResult class Tilted log-normaliser and its derivatives w.r.t. the cavity mean.
statistical_linear_regression function Moment-match a nonlinear conditional to a linear-Gaussian surrogate.
SLRResult class Linear-Gaussian surrogate produced by statistical linear regression.

Hyperparameter designs (INLA)

Name Kind What it does
theta_design function Integration points and log-weights over hyperparameters \(\theta\).

Kernel expectations & uncertain-input GPs

Name Kind What it does
kernel_expectations function Compute kernel expectations Psi_0, Psi_1, Psi_2 for uncertain inputs.
compute_psi_statistics function Compute Ψ statistics, dispatching to analytical or numerical.
AnalyticalPsiStatistics class Protocol for kernels with closed-form Ψ statistics.
uncertain_gp_predict function Predictive mean and variance for GP with uncertain inputs.
uncertain_gp_predict_mc function Monte Carlo GP prediction with uncertain inputs.
uncertain_svgp_predict function Predictive mean and variance for SVGP with uncertain inputs.
uncertain_vgp_predict function Predictive mean and variance for dense VGP with uncertain inputs.
uncertain_bgplvm_predict function Multi-output uncertain GP prediction for BGPLVM.

State-Space Models & Kalman

SDE kernels

Name Kind What it does
SDEKernel class Abstract base class for state-space kernel representations.
SDEParams class Continuous-time SDE parameters for a linear SDE.
ConstantSDE class State-space representation of a constant kernel.
MaternSDE class State-space representation of the Matern kernel.
PeriodicSDE class State-space representation of the periodic (MacKay) kernel.
QuasiPeriodicSDE class Quasi-periodic kernel: product of Matern and Periodic SDE.
CosineSDE class State-space representation of the cosine kernel.
IntegratedWienerSDE class State-space representation of an integrated Wiener process.
ProductSDE class Product of two SDE kernels via Kronecker composition.
SumSDE class Sum of SDE kernels via block-diagonal composition.
sde_autocovariance function Compute the stationary autocovariance of an SDE kernel.
discretize_mfd function Discretise a linear SDE by matrix-fraction decomposition.
discretize_mfd_sequence function Vectorised gaussx.discretize_mfd over a vector of time steps.

Nonlinear filters

Name Kind What it does
nonlinear_kalman_filter function Moment-matched nonlinear Kalman filter.
nonlinear_rts_smoother function Moment-matched nonlinear Rauch-Tung-Striebel smoother.
nonlinear_kalman_predict function One moment-matched predict step.
nonlinear_kalman_update function One moment-matched update step.
nonlinear_rts_step function One moment-matched RTS backward step.
masked_moment_inputs function Make masked observation channels inert in a moment-matched update.

Kalman filtering & smoothing

Name Kind What it does
EmissionModel class Observation (emission) model wrapping a linear observation matrix.
FilterState class Output of kalman_filter.
kalman_filter function Kalman filter forward pass via jax.lax.scan.
rts_smoother function Rauch-Tung-Striebel backward smoother.
kalman_gain function Compute Kalman gain K = P @ H^T @ (H @ P @ H^T + R)^{-1}.
parallel_kalman_filter function Parallel Kalman filter via jax.lax.associative_scan.
parallel_rts_smoother function Parallel RTS smoother via reverse jax.lax.associative_scan.
meanfield_kalman_filter function Mean-field Kalman filter over L = D // block_size state blocks.
meanfield_rts_smoother function Mean-field RTS smoother over L = D // block_size state blocks.
infinite_horizon_filter function Infinite-horizon Kalman filter with fixed steady-state gain.
infinite_horizon_smoother function Infinite-horizon RTS smoother with fixed steady-state gain.
dare function Steady-state Kalman filter covariance and gain (the filtering DARE).
DAREResult class Result of DARE solver.
pairwise_marginals function Joint p(x_k, x_{k+1}) for each consecutive pair.

SpInGP

Name Kind What it does
spingp_log_likelihood function Log marginal likelihood via sparse inverse GP formulation.
spingp_posterior function Posterior mean and precision via SpInGP.

Precision-form chains

Name Kind What it does
UDLDecomposition class Banded factorisation \(\Lambda = U \tilde{D} U^{\top}\) of a BlockTriDiag.
udl_decomposition function Factorise a symmetric block-tridiagonal precision as \(U \tilde{D} U^{\top}\).
udl_to_ssm_params function Read the equivalent Gauss-Markov chain off a UDLDecomposition.
udl_from_ssm_params function Build the UDLDecomposition of a Gauss-Markov chain's precision.

Sites & natural parameters

Name Kind What it does
GaussianSites class Time-varying Gaussian likelihood sites in natural parameterization.
cvi_update_sites function Natural gradient update for CVI sites.
sites_to_precision function Convert Gaussian sites to a block-tridiagonal precision.
cavity_from_marginal function Compute cavity distribution by removing a site from the marginal.
site_natural_from_tilted function Compute site natural parameters from tilted and cavity moments.
site_mean_var_from_natural function Convert per-site natural parameters to mean/variance.
expectations_to_ssm function Convert expectation parameters back to SSM marginals.
naturals_to_ssm function Convert natural parameters back to SSM parameters.
ssm_to_expectations function Convert SSM marginals to expectation parameters.
ssm_to_naturals function Convert SSM parameters to natural parameters.

Variational SDE linearisation

Name Kind What it does
LinearizedSDE class Linear surrogate \(dx = (A_t x + b_t)\,dt + Q_t^{1/2}\,dW\) of an SDE.
linearize_sde function Optimal linear drift of a nonlinear SDE along a Gaussian path.
sde_kl_divergence function Drift path-KL between a linear and a nonlinear SDE along a Gaussian path.

Process noise

Name Kind What it does
process_noise_covariance function Compute process noise from stationary covariance.

Bayesian Inference & Ensembles

Bayesian learning rule

Name Kind What it does
blr_full_update function Full-rank natural parameter BLR update step.
blr_diag_update function Diagonal natural parameter BLR update step.
log_marginal_likelihood function GP log marginal likelihood.
gaussian_expected_log_lik function Expected log-likelihood E_q[log N(y \| f, R)].

Newton & natural-gradient updates

Name Kind What it does
newton_update function Convert a Newton step to natural pseudo-likelihood parameters.
damped_natural_update function Damped update in natural parameter space.
gauss_newton_precision function Gauss-Newton precision matrix J^T J, optionally plus a prior.
ggn_diagonal function Generalized Gauss-Newton diagonal approximation.
hutchinson_hessian_diag function Stochastic Hessian diagonal via Hutchinson with Rademacher probes.
riemannian_psd_correction function Riemannian gradient correction for PSD precision updates.
cavity_distribution function Compute EP cavity distribution by removing a site.
trace_correction function Trace term in Titsias collapsed ELBO.

Precision-form Laplace (INLA)

Name Kind What it does
laplace_mode function Mode, Hessian and log-marginal of the Laplace approximation, in precision form.
LaplaceResult class The Gaussian approximation \(\mathcal N(\hat x, H^{-1})\) at the mode.

Low-rank VB mean correction (INLA)

Name Kind What it does
vb_mean_correction function Low-rank VB correction of the Laplace mean (Van Niekerk & Rue, 2024).

Ensemble covariances, gain & analysis

Name Kind What it does
ensemble_covariance function Empirical covariance from an ensemble as a low-rank operator.
ensemble_cross_covariance function Cross-covariance between two ensemble sets.
ensemble_kalman_gain function Kalman gain from an ensemble and its image in observation space.
enkf_analysis function Stochastic (perturbed-observation) ensemble Kalman analysis step.
etkf_transform function Ensemble Transform Kalman Filter (ETKF) analysis weights.

Ensemble Kalman inversion

Name Kind What it does
eki_step function One ensemble Kalman inversion (EKI) update.
tikhonov_augment function Observation augmentation for Tikhonov-regularised EKI (TEKI).
discrepancy_step_size function Adaptive EKI tempering step: the data misfit controller.

Localization & inflation

Name Kind What it does
localization_matrix function Pairwise Gaspari-Cohn taper rho(dist(a_i, b_j); c).
localized_kalman_gain function Ensemble Kalman gain with Hadamard (Schur-product) localization.
gaspari_cohn function Gaspari-Cohn (1999) fifth-order compactly-supported taper.
inflate_multiplicative function Multiplicative ensemble inflation about the mean.
inflate_rtpp function Relaxation to prior perturbations (RTPP; Zhang et al. 2004).
inflate_rtps function Relaxation to prior spread (RTPS; Whitaker & Hamill 2012).

Distances

Name Kind What it does
euclidean_distance function Pairwise Euclidean distances \|\|a_i - b_j\|\|.
haversine_distance function Pairwise great-circle (haversine) distances on a sphere.

Listed at lineax 0.1.1, matfree 0.6.2, optimistix 0.1.0.

Upstream: lineax

The operator protocol, tags and solvers every gaussx operator extends. Use these before wrapping or re-implementing an operator or solver.

Name Kind What it does
AbstractLinearOperator class Abstract base class for all linear operators.
AbstractLinearSolver class Abstract base class for all linear solvers.
AddLinearOperator class A linear operator formed by adding two other linear operators together.
AutoLinearSolver class Automatically determines a good linear solver based on the structure of the operator.
BiCGStab class Biconjugate gradient stabilised method for linear systems.
CG class Conjugate gradient solver for linear systems.
Cholesky class Cholesky solver for linear systems.
ComposedLinearOperator class A linear operator formed by composing (matrix-multiplying) two other linear operators together.
Diagonal class Diagonal solver for linear systems.
DiagonalLinearOperator class A diagonal linear operator, e.g. for a diagonal matrix.
DivLinearOperator class A linear operator formed by dividing a linear operator by a scalar.
FunctionLinearOperator class Wraps a linear function fn: X -> Y into a linear operator. (So that self.mv(x) is defined by self.mv(x) == fn(x).)
GMRES class GMRES solver for linear systems.
IdentityLinearOperator class Represents the identity transformation X -> X, where each x in X is some PyTree of floating-point JAX arrays.
JacobianLinearOperator class Given a function fn: X -> Y, and a point x in X, then this defines the linear operator (also a function X -> Y) given by the Jacobian (d(fn)/dx)(x).
LSMR class LSMR solver for linear systems.
LU class LU solver for linear systems.
MatrixLinearOperator class Wraps a 2-dimensional JAX array into a linear operator.
MulLinearOperator class A linear operator formed by multiplying a linear operator by a scalar.
NegLinearOperator class A linear operator formed by computing the negative of a linear operator.
Normal class Wrapper for an inner solver of positive (semi)definite systems.
NormalCG function Deprecated helper function.
PyTreeLinearOperator class Represents a PyTree of floating-point JAX arrays as a linear operator.
QR class QR solver for linear systems.
RESULTS class An enumeration, with the following entries:
SVD class SVD solver for linear systems.
Solution class The solution to a linear solve.
TaggedLinearOperator class Wraps another linear operator and specifies that it has certain tags, e.g. representing symmetry.
TangentLinearOperator class Internal to lineax.
Triangular class Triangular solver for linear systems.
Tridiagonal class Tridiagonal solver for linear systems, uses the LAPACK/cusparse implementation of Gaussian elimination with partial pivotting (which increases stability). .
TridiagonalLinearOperator class As lineax.MatrixLinearOperator, but for specifically a tridiagonal matrix.
conj function Elementwise conjugate of a linear operator.
diagonal function Extracts the diagonal from a linear operator, and returns a vector.
diagonal_tag constant Structural / property tag for operators.
has_unit_diagonal function Returns whether an operator is marked as having unit diagonal.
invert function Returns a lineax.FunctionLinearOperator representing the (pseudo)inverse of operator.
is_diagonal function Returns whether an operator is marked as diagonal.
is_lower_triangular function Returns whether an operator is marked as lower triangular.
is_negative_semidefinite function Returns whether an operator is marked as negative semidefinite.
is_positive_semidefinite function Returns whether an operator is marked as positive semidefinite.
is_symmetric function Returns whether an operator is marked as symmetric.
is_tridiagonal function Returns whether an operator is marked as tridiagonal.
is_upper_triangular function Returns whether an operator is marked as upper triangular.
linear_solve function Solves a linear system.
linearise function Linearises a linear operator.
lower_triangular_tag constant Structural / property tag for operators.
materialise function Materialises a linear operator.
negative_semidefinite_tag constant Structural / property tag for operators.
positive_semidefinite_tag constant Structural / property tag for operators.
symmetric_tag constant Structural / property tag for operators.
transpose_tags function Lineax uses "tags" to declare that a particular linear operator exhibits some property, e.g. symmetry.
transpose_tags_rules constant Re-exported from builtins.
tridiagonal function Extracts the diagonal, lower diagonal, and upper diagonal, from a linear operator.
tridiagonal_tag constant Structural / property tag for operators.
unit_diagonal_tag constant Structural / property tag for operators.
upper_triangular_tag constant Structural / property tag for operators.

Upstream: matfree

Matrix-free Krylov decompositions, matrix functions and stochastic trace / diagonal estimators. Never hand-roll Lanczos, Arnoldi or Hutchinson.

matfree.decomp

Name Kind What it does
bidiag function Construct an implementation of bidiagonalisation via the Golub-Kahan algorithm.
hessenberg function Construct a Hessenberg-factorisation via the Arnoldi iteration.
tridiag_sym function Construct an implementation of tridiagonalisation.

matfree.eig

Name Kind What it does
eig_partial function Compute a partial eigendecomposition of an arbitrary square matrix via Hessenberg factorisation.
eigh_partial function Compute a partial eigendecomposition \(A \approx V \Lambda V^\top\) for symmetric/Hermitian matrices.
svd_partial function Compute a partial SVD \(A \approx U \Sigma V^\top\) via bidiagonalisation.

matfree.funm

Name Kind What it does
dense_funm_pade_exp function Implement dense matrix-exponentials using a Pade approximation.
dense_funm_product_svd function Implement dense matrix-functions of a product of matrices via SVDs.
dense_funm_schur function Implement dense matrix-functions via symmetric Schur decompositions.
dense_funm_sym_eigh function Implement dense matrix-functions via symmetric eigendecompositions.
funm_arnoldi function Implement a matrix-function-vector product via the Arnoldi iteration.
funm_chebyshev function Compute a matrix-function-vector product via Chebyshev's algorithm.
funm_lanczos_sym function Implement a matrix-function-vector product via Lanczos' tridiagonalisation.
monte_carlo_funm_product function Construct the integrand for matrix-function-trace estimation.
monte_carlo_funm_product_logdet function Construct the integrand for the log-determinant of a matrix-product.
monte_carlo_funm_product_schatten_norm function Construct the integrand for the \(p\)-th power of the Schatten-p norm.
monte_carlo_funm_sym function Construct the integrand for matrix-function-trace estimation.
monte_carlo_funm_sym_logdet function Construct the integrand for the log-determinant.

matfree.low_rank

Name Kind What it does
cholesky_partial function Compute a partial Cholesky factorisation.
cholesky_partial_pivot function Compute a partial Cholesky factorisation with pivoting.
preconditioner function Turn a low-rank approximation into a preconditioner.

matfree.lstsq

Name Kind What it does
lsmr function Construct a matrix-free implementation of LSMR.

matfree.stochtrace

Name Kind What it does
estimator_leave_one_out function Construct a leave-one-out stochastic estimator.
estimator_leave_one_out_mean_and_sem function Construct a LOO estimator that returns mean and standard error.
estimator_monte_carlo function Construct a stochastic trace-/diagonal-estimator.
estimator_monte_carlo_mean_and_sem function Construct a stochastic estimator that returns mean and standard error.
leave_one_out_xdiag function Construct an integrand for estimating the diagonal using the XDiag algorithm (Epperly et al. 2024).
leave_one_out_xnysdiag function Construct an integrand for estimating the diagonal of a positive semi-definite operator using the XNysDiag algorithm (Epperly et al. 2025).
leave_one_out_xnystrace function Construct an integrand for estimating the trace of a positive semi-definite operator using the XNysTrace algorithm (Epperly et al. 2024).
leave_one_out_xrownorms_squared function Construct an integrand for estimating squared row norms using the XRowNorm algorithm (Epperly, 2025).
leave_one_out_xsymrownorms_squared function Construct an integrand for estimating squared row norms of a normal operator using the XSymRowNorm algorithm (Epperly, 2025).
leave_one_out_xtrace function Construct an integrand for estimating the trace using the XTrace algorithm (Epperly et al. 2024).
monte_carlo_diagonal function Construct the integrand for estimating the diagonal.
monte_carlo_frobeniusnorm_squared function Construct the integrand for estimating the squared Frobenius norm.
monte_carlo_rownorms_squared function Construct the integrand for estimating the squared row norms.
monte_carlo_trace function Construct the integrand for estimating the trace.
monte_carlo_trace_and_diagonal function Construct the integrand for estimating the trace and diagonal jointly.
nystrom_eigh function Construct a Nystrom approximation of an operator using a Hermitian eigendecomposition.
nystrom_shifted_cholesky function Construct a Nystrom approximation of a shifted operator using a Cholesky decomposition.
sampler_normal function Construct a function that samples from a standard-normal distribution.
sampler_signs function Construct a function that samples signs uniformly.
sampler_sphere function Construct a function that samples from a unit sphere scaled to have identity covariance.

matfree.bounds

Name Kind What it does
baigolub96_logdet_spd function Bound the log-determinant of a symmetric, positive definite matrix.

Upstream: optimistix

Root finding, fixed points, minimisation and least squares with implicit-differentiation adjoints. Use it instead of a hand-written while_loop when gradients must flow through the iteration.

Name Kind What it does
AbstractAdjoint class The abstract base class of all adjoints.
AbstractBFGS class Abstract version of the BFGS (Broyden–Fletcher–Goldfarb–Shanno) minimisation algorithm.
AbstractDFP class Abstract version of the DFP (Davidon–Fletcher–Powell) minimisation algorithm.
AbstractDescent class The abstract base class for descents.
AbstractFixedPointSolver class Abstract base class for all fixed point solvers.
AbstractGaussNewton class Abstract base class for all Gauss-Newton type methods.
AbstractGradientDescent class The gradient descent method for unconstrained minimisation.
AbstractIterativeSolver class Abstract base class for all iterative solvers.
AbstractLBFGS class Abstract version of the L-BFGS (limited memory Broyden–Fletcher–Goldfarb–Shanno) solver.
AbstractLeastSquaresSolver class Abstract base class for all least squares solvers.
AbstractMinimiser class Abstract base class for all minimisers.
AbstractQuasiNewton class Abstract quasi-Newton minimisation algorithm.
AbstractRootFinder class Abstract base class for all root finders.
AbstractSearch class The abstract base class for all searches. (Which are our generalisation of line searches, trust regions, and learning rates.)
BFGS class BFGS (Broyden–Fletcher–Goldfarb–Shanno) minimisation algorithm.
BacktrackingArmijo class Perform a backtracking Armijo line search.
BestSoFarFixedPoint class Wraps another fixed-point solver, to return the best-so-far value.
BestSoFarLeastSquares class Wraps another least-squares solver, to return the best-so-far value.
BestSoFarMinimiser class Wraps another minimiser, to return the best-so-far value.
BestSoFarRootFinder class Wraps another root-finder, to return the best-so-far value.
Bisection class The bisection method of root finding.
Chord class The Chord method of root finding.
ClassicalTrustRegion class The classic trust-region update algorithm which uses a quadratic approximation of the objective function to predict reduction.
DFP class DFP (Davidon–Fletcher–Powell) minimisation algorithm.
DampedNewtonDescent class The damped Newton (Levenberg--Marquardt) descent.
Dogleg class Dogleg algorithm.
DoglegDescent class The Dogleg descent step, which switches between the Cauchy and the Newton descent directions.
FixedPointIteration class Repeatedly calls a function in search of a fixed point.
FunctionInfo class Different solvers (BFGS, Levenberg--Marquardt, ...) evaluate different quantities of the objective function.
GaussNewton class Gauss-Newton algorithm, for solving nonlinear least-squares problems.
GoldenSearch class Golden-section search for finding the minimum of a univariate function in a given interval.
GradientDescent class Classic gradient descent with a learning rate learning_rate.
ImplicitAdjoint class Backpropagate via the implicit function theorem.
IndirectDampedNewtonDescent class The indirect damped Newton (Levenberg--Marquardt) trust-region descent.
IndirectLevenbergMarquardt class The Levenberg--Marquardt method as a true trust-region method.
LBFGS class L-BFGS (Limited-memory Broyden–Fletcher–Goldfarb–Shanno) minimisation algorithm.
LearningRate class Move downhill by taking a step of the fixed size learning_rate.
LevenbergMarquardt class The Levenberg--Marquardt method.
LinearTrustRegion class The trust-region update algorithm which uses a linear approximation of the objective function to predict reduction.
NelderMead class The Nelder-Mead minimisation algorithm. (Downhill simplex derivative-free method.)
Newton class Newton's method for root finding.
NewtonDescent class Newton descent direction.
NonlinearCG class The nonlinear conjugate gradient method.
NonlinearCGDescent class The nonlinear conjugate gradient step.
OptaxMinimiser class A wrapper to use Optax first-order gradient-based optimisers with optimistix.minimise.
RESULTS class An enumeration, with the following entries:
RecursiveCheckpointAdjoint class Backpropagate by differentiating through the iterates directly.
Solution class The solution to a nonlinear solve.
SteepestDescent class The descent direction given by locally following the gradient.
dai_yuan function The Dai--Yuan formula for β.
fixed_point function Find a fixed-point of a function.
fletcher_reeves function The Fletcher--Reeves formula for β.
hestenes_stiefel function The Hestenes--Stiefel formula for β.
least_squares function Solve a nonlinear least-squares problem.
max_norm function Compute the L-infinity norm of a PyTree of arrays.
minimise function Minimise a function.
polak_ribiere function The Polak--Ribière formula for β.
rms_norm function Compute the RMS (root-mean-squared) norm of a PyTree of arrays.
root_find function Solve a root-finding problem.
two_norm function Computes the L2 norm of a PyTree of arrays.

Shared private toolkits

Not public API: the plumbing gaussx's own modules share. Contributors use these instead of writing new helpers; a helper two modules need is added here, not inline in one caller.

Module Purpose Helpers
gaussx._einx Typed einx adapters for tensor reshaping and contraction. rearrange, repeat, reduce, einsum
gaussx._testing Test utilities for gaussx. default_tolerances, tree_allclose, _resolve_dtype, key_sequence, random_pd_matrix, random_pd_operator, psd_operator, random_kronecker_pd, random_block_diag_pd, random_low_rank_update, random_sum_of_kroneckers_pd, random_spd_block_tridiag, empirical_moments, dense_solve, dense_logdet, dense_inv, dense_diag, dense_trace, assert_sample_moments
gaussx._deprecation gaussx's own deprecation warning category and helper (gh-332). GaussxDeprecationWarning, renamed_attribute, warn_deprecated, renamed_kwargs
gaussx._operators._utils Private utilities shared by operator implementations. lineax_diagonal, _square_components, lineax_conj, register_lineax_structure_functions, _identity
gaussx._strategies._dispatch Dispatch helpers: route through solver strategy or fall back to primitives. dispatch_solve, dispatch_logdet
gaussx._strategies._tolerances Dtype-aware default tolerances for the iterative strategies (gh-327). operator_dtype, resolve_tolerance, rhs_scaling
gaussx._strategies._lineax Adapter from a lineax solver to a gaussx solve strategy (gh-376). LineaxSolver, as_solve_strategy
gaussx._distributions._utils Shared helpers for batched distribution reshaping. _axis_names, _reshape_batch, _reshape_series, _reshape_samples, _unflatten_sample_axis
gaussx._ssm._utils Shared internal helpers for SSM operators. _materialise, _matvec, _as_operator, _right_matmul_transpose, _left_matmul, _innovation_covariance, _masked_obs_inputs, _is_operator_input, _normalise_tv_inputs, _warn_unused_process_noise