Gaussian maths in gauss_flows comes from gaussx
Design · gauss_flows, gaussx and the dependency graph
1 Dec 2026 · draft for review
Status: proposed
Updated 1 Dec 2026. Under the gauss_flows layout, every distribution, filter and information-theory function on this page lives in
gauss-flows-models(GeoML), which declares gaussx;gauss-flows-maps(Core) does not need gaussx.monotone_inversecomes fromgauss-flows-maps, not argminax.
Repositories: gauss_flows (flowjax distributions), gaussx (Gaussian maths, unchanged), geostack (dependency graph)
Companion page: gauss_flows conditioning, which moves gauss_flows’s conditioning onto geonnax. This page does not depend on it. See also gauss_flows monotone maps, which puts the inverses and splines of gauss_flows’s elementwise bijections in functax. gauss_flows reparametrisation stores the mixture’s Cholesky factors and weights through argminax’s structured maps.
Related: gauss_flows#138 (wrong σ power in
GaussianPCA), geostack#253 (geo-inference workspace), gaussx#846 (the NumPyro distributions leave gaussx for pyrox-gauss)
1Decision¶
Recommended: gauss_flows declares gaussx as a base dependency and takes every Gaussian density, sample, entropy, divergence and Kalman recursion with a non-diagonal covariance from it.
gauss_flows keeps thin flowjax.distributions.AbstractDistribution shells that hold the parameters and call gaussx, plus what is not Gaussian maths: the mixture’s log-sum-exp over components, total correlation and mutual information as differences of entropies, and the Kalman flow’s composition.
Diagonal Gaussians whose log-scale is known keep their change-of-variables form, because routing them through a covariance operator loses precision (see the background maths).
GaussianPCA becomes LowRankGaussian, one shell for any low-rank-plus-diagonal covariance, with isotropic noise (probabilistic PCA) or a free diagonal (factor analysis).
Two more shells open gaussx’s structured Gaussians to flows as bases: StructuredGaussian for a covariance operator (Toeplitz, Kronecker, block-tridiagonal, low-rank) and GMRFBase for gaussx’s Gaussian Markov random fields, which are defined by a precision.
What does not change: gaussx itself, gauss_flows’s other public class names, and its flowjax-facing API (log_prob, sample, cond_shape). GaussianPCA is removed with no deprecation window; the PR body lists the old and new names, and pyrox-gp’s tests/gp/test_latent_factor.py, which uses it as an oracle, follows when it bumps.
Alternative: keep gauss_flows’s own Gaussian code and only fix gauss_flows#138. It is the smallest change, but it leaves a second copy of the Woodbury identity and the Kalman recursion to drift, and the gaussx tests stay skipped.
2Motivation¶
gauss_flows re-derives Gaussian maths that gaussx owns, and one copy is wrong. GaussianPCA hand-writes the Woodbury identity and the matrix-determinant lemma for Σ = W Wᵀ + σ² I, and its quadratic form divides the correction term by σ⁴ where the identity gives σ² (gauss_flows#138). GaussianMixture hand-writes a Cholesky log-density for its full-covariance mode. info_theory.py computes gaussian_entropy and gaussian_kl_divergence with dense jnp.linalg.slogdet. gaussx v0.8.4 has gaussian_log_prob, gaussian_entropy, gaussian_kl, sample_mvn, low_rank_plus_diag and woodbury_solve on lineax operators, with structural dispatch.
GaussianPCA is a low-rank Gaussian with nothing specific to PCA. It has no eigendecomposition and no fit from data. What it adds over 𝒩(μ, W Wᵀ + σ² I) is the tie of the noise to one scalar σ², a log_sigma parameter with a 10⁻¹² floor on σ², and a dense covariance() helper for tests. Its sampler, x = μ + W z + σ ε, is the draw gaussx.sample_mvn already makes for a LowRankUpdate (L_A₀ z₁ + U D^½ z₂, at O(DK) cost). Tying the noise to one scalar is a choice, not a structure: a free diagonal is factor analysis, which gaussx’s low_rank_plus_diag takes as readily.
gauss_flows’s bases ignore the structure of geoscience data. Its Gaussian bases are independent, diagonal or low-rank, so a flow over a gridded field or a long series must learn all spatial or temporal correlation in its bijections. gaussx already has Gaussians with that structure. sample_mvn and gaussian_log_prob take any lineax covariance, and sample_mvn draws exactly at the structure’s own cost: O(D log D) by FFT for a Toeplitz, per-factor eigendecompositions for a Kronecker or KroneckerSum, a banded Cholesky for a BlockTriDiag. GaussianMRF, IntrinsicGMRF, BYM2GMRF and ConstrainedGMRF are equinox modules with their own log_prob and sample(key, sample_shape), and spde_precision_grid and ar1_precision build Matérn and AR(1) precisions for them. SDEKernel (for example MaternSDE) gives the discrete-time matrices of a Gaussian process in state-space form through discretise_sequence and initial_covariance.
gauss_flows uses gaussx only behind a guard, so its gaussx tests are skipped in CI. transform_filter.py and conjugate_filter.py import gaussx through _require_gaussx, and tests/test_flows_conjugate_filter.py skips itself when gaussx is not importable, which it never is in CI because nothing declares it. geostack’s dependency check allows this as the one entry in UNDECLARED_OK (scripts/dependency_graph.py): “gaussx is not on PyPI, and gauss_flows’ [interp] extra (interpax) caps lineax below what gaussx needs”. gauss_flows replaced interpax with functax on main and has no extras left, so the reason is gone.
The two now resolve together. In a scratch copy of gauss_flows’s pyproject.toml on 1 Dec 2026, adding gaussx @ git+…@v0.8.4 (with functax moved to v0.0.10) resolved in one pass: jax 0.12.1, lineax 0.1.1, matfree 0.6.3, numpyro 0.22.0, flowjax 19.2.1. gaussx’s floors are jax 0.10, equinox 0.13.8 and lineax 0.1.1. The tests were not run.
The Kalman flow’s example points at a class gaussx no longer has. The normalizing_kalman_filter docstring builds its base from gaussx.LGSSM, and its error message names gaussx.LGSSMFactory. Both moved to pyrox-gauss with the other NumPyro distributions in gaussx#846, and pyrox-gauss is in GeoML tier 2, above gauss_flows, so gauss_flows cannot point at it. gauss_flows does not run doctests in CI (addopts has no --doctest-modules), so nothing caught it.
3User stories¶
As a user of gauss_flows’s low-rank base, I want its log-density to come from the same code as gaussx’s, so that it is correct and gets gaussx’s solver choices.
As a user whose variables have different noise levels, I want the low-rank base with a per-dimension noise variance, so that I can fit factor analysis without writing a new distribution.
As a modeller of a gridded field, I want a flow whose base is a Matérn field on the grid, so that the flow’s bijections only need to learn what the Gaussian field cannot express.
As a modeller of irregularly sampled time series, I want a Gaussian-process base over the observation times, so that the normalizing Kalman filter starts from a sensible temporal prior.
As a maintainer of gauss_flows, I want the filter tests that need gaussx to run in CI, so that a change to either library that breaks them is seen.
As a user of the normalizing Kalman filter, I want its documented example to run with gauss_flows and gaussx alone, so that I do not need a library above gauss_flows to try it.
4Background maths¶
Symbols¶
The event is x ∈ ℝᴰ, with mean μ ∈ ℝᴰ and covariance Σ ∈ ℝ^(D×D). For the low-rank base, the loading is W ∈ ℝ^(D×K) with K ≤ D, and the noise covariance is Ψ = diag(ψ) with every ψ_i > 0; isotropic noise is ψ = σ² 1 for one σ² > 0. For a diagonal Gaussian, the scale is γ ∈ ℝᴰ with γ = σ_+(r) for a raw value r and a positive map σ_+ (exp in gauss_flows today). For the state-space base, y_1:T are observations with y_t ∈ ℝᴹ, and the state follows a linear-Gaussian model with transition A, observation matrix H, and noise covariances Q and R.
Which form goes where¶
A diagonal Gaussian whose scale comes from a positive map is an affine flow of a standard normal, x = μ + γ ⊙ ε with ε ~ 𝒩(0, I), and its density is the change-of-variables formula:
Its log-determinant is Σ log σ_+(r), which is computed from the raw value r and stays finite.
Routing it through a covariance operator diag(γ²) would recompute log det from γ², which underflows to −∞ once γ² falls below float32’s smallest normal number (about 1.2 × 10⁻³⁸, so γ below about 10⁻¹⁹).
So ConditionalDiagGaussian, ClassCondDiagGaussian and the diagonal mode of GaussianMixture keep this form; the gauss_flows conditioning page gives them one implementation through geonnax.
Every other covariance goes to gaussx. For the low-rank base,
which gaussx evaluates through low_rank_plus_diag and gaussian_log_prob.
Isotropic noise, Ψ = σ² I, is probabilistic PCA [1]; a free diagonal is factor analysis [2].
By the Woodbury identity and the matrix-determinant lemma, with the K × K capacitance M = I + Wᵀ Ψ⁻¹ W,
so the cost is O(DK² + K³) instead of O(D³).
With Ψ = σ² I the inverse is σ⁻² (I − W (σ² I + Wᵀ W)⁻¹ Wᵀ), so the correction term carries σ⁻², not σ⁻⁴; the σ⁻⁴ in today’s GaussianPCA is the bug in gauss_flows#138.
A sample is x = μ + W z + Ψ^½ ε with z ∈ ℝᴷ and ε ∈ ℝᴰ standard normal, at O(DK) cost without forming Σ.
A full-covariance mixture component with mean μ_k and Cholesky factor L_k uses the same function on the operator L_k L_kᵀ, and the mixture is
where the weights w_k sum to one; the log-sum-exp stays in gauss_flows.
The entropy and the KL divergence of Gaussians use gaussian_entropy and gaussian_kl.
Total correlation and mutual information stay in gauss_flows, written as differences of gaussx entropies: for a covariance Σ with diagonal entries Σ_ii, the total correlation is Σᵢ H(𝒩(0, Σ_ii)) − H(𝒩(0, Σ)), and for a split into blocks x and y the mutual information is H_x + H_y − H_xy.
The linear-Gaussian state-space base has the density p(y_1:T) of the model
with s_0 ~ 𝒩(m_0, P_0).
gaussx.kalman_filter returns a FilterState whose log_likelihood is log p(y_1:T), and it takes a mask of shape (T,) or (T, M) for missing observations.
A Gaussian process over time with a Matérn or other SDEKernel is this model with time-varying matrices [5].
For observation times t_1 < … < t_T with gaps Δ_t = t_t − t_(t−1), the kernel’s discretise_sequence(Δ) returns the transitions A_t and process noises Q_t, its sde_params().H is the observation row H, and its initial_covariance() is the stationary covariance P_0 = Σ_∞; R is the observation noise.
Structured bases¶
A structured base is 𝒩(μ, Σ) whose covariance, or whose precision Λ = Σ⁻¹, is an operator with structure the sampler and the density can use. Defined by a covariance, the base needs only the two functions gaussx already has:
sample_mvn chooses L by structure, and gaussian_log_prob chooses its solve and log-determinant by structure:
| Covariance Σ | Typical base | Exact draw cost |
|---|---|---|
Toeplitz | stationary series on a regular grid | O(D log D) |
Kronecker | separable space × time | per-factor eigendecompositions |
KroneckerSum | separable 2-D field | per-factor eigendecompositions |
BlockTriDiag | Markov chain | O(B d³) |
LowRankUpdate | LowRankGaussian | base’s cost + O(DK) |
Defined by a precision, the base is a Gaussian Markov random field, 𝒩(μ, Λ⁻¹), with Λ sparse or structured.
A Matérn field on a regular grid is the solution of the SPDE (κ² − Δ)^(α/2) τ x = 𝒲 with white noise 𝒲 [4], whose precision spde_precision_grid(shape, κ, τ, α) builds; κ sets the correlation length (about √(8ν)/κ for smoothness ν = α − d/2 in d dimensions) and τ the variance.
gaussx’s GMRF modules evaluate log 𝒩(x; μ, Λ⁻¹) = ½ log det Λ − ½ (x − μ)ᵀ Λ (x − μ) − (D/2) log 2π, and sample by a factorisation, by per-factor eigenvalues, or matrix-free by perturbation-optimisation, depending on Λ.
5Background numerics¶
Precision. gaussx factors a dense PSD covariance once and reads the quadratic form and the log-determinant from the factor; for a LowRankUpdate it uses the Woodbury structure (to be confirmed by gate G-G5). Its tests run in float64; gauss_flows’s run in float32, so the gates below use float32 tolerances.
jit, grad and vmap. The gaussx functions act on one event and are batched with jax.vmap, as flowjax distributions are. Solver strategies are static configuration.
Cost. gaussx’s structural dispatch should make LowRankGaussian’s log-density cost what today’s hand-written Woodbury costs (unverified; gate G-G5). kalman_filter is a sequential scan over T steps of O(N³ + M³), the same as a hand-written filter; gaussx also has parallel_kalman_filter for long series.
For the structured bases, sample_mvn documents its cost per structure; whether gaussian_log_prob avoids forming a dense D × D matrix for every structure in the table is unverified, and gate G-G8 checks it.
6What it builds on¶
| Need | Upstream name | State on main |
|---|---|---|
| Gaussian log-density on an operator | gaussx.gaussian_log_prob | today (gaussx v0.8.4) |
| Entropy and KL divergence | gaussx.gaussian_entropy, gaussx.gaussian_kl | today (gaussx v0.8.4) |
| Samples from a structured covariance | gaussx.sample_mvn | today (gaussx v0.8.4) |
| Low-rank plus diagonal covariance | gaussx.low_rank_plus_diag | today (gaussx v0.8.4) |
| Kalman log-likelihood with a mask | gaussx.kalman_filter | today (gaussx v0.8.4) |
| Ensemble analysis, nonlinear filter | gaussx.enkf_analysis, gaussx.nonlinear_kalman_filter | today, guarded import (gaussx v0.8.4) |
| Structured covariances | gaussx.Toeplitz, Kronecker, KroneckerSum, BlockTriDiag | today (gaussx v0.8.4) |
| Gaussian Markov random fields | gaussx.GaussianMRF, IntrinsicGMRF, BYM2GMRF, ConstrainedGMRF | today (gaussx v0.8.4) |
| Matérn and AR(1) precisions | gaussx.spde_precision_grid, gaussx.ar1_precision | today (gaussx v0.8.4) |
| Gaussian processes in state-space form | gaussx.SDEKernel, gaussx.MaternSDE | today (gaussx v0.8.4) |
| Distribution shells | flowjax.distributions.AbstractDistribution | today (flowjax) |
Nothing is missing upstream, and gaussx does not change.
gaussx has no NumPyro distributions any more: they moved to pyrox-gauss (gaussx#846), which gauss_flows may not import. The flowjax shells therefore stay in gauss_flows, and only the maths moves.
The four GMRF classes share no base class in gaussx, but they share the methods GMRFBase needs (event_shape, log_prob, sample(key, sample_shape)), so gauss_flows types them with a Protocol. A shared abstract class in gaussx would be tidier; nothing here needs it.
7Ownership¶
gaussx owns Gaussian densities, entropies, divergences, samples and Kalman recursions on lineax operators, the structured operators, the GMRF modules and their precision builders, and the SDE kernels. It does not change here.
gauss_flows owns the flowjax distribution shells that call gaussx, the diagonal change-of-variables densities, the mixture’s log-sum-exp, total correlation and mutual information, and the Kalman flow’s composition. It imports gaussx at module level and re-exports none of its names.
geostack removes the
("gauss-flows", "gaussx")entry fromUNDECLARED_OK, so gaussx becomes an ordinary declared edge; gaussx is in Numerics, below GeoML, so the edge already points down.
8API proposal¶
Three shells hold covariance-defined Gaussians. An abstract base owns the two calls into gaussx, and each subclass only says how it builds its covariance operator.
class AbstractOperatorGaussian(AbstractDistribution):
"""𝒩(μ, Σ) with Σ a lineax operator; the subclass builds Σ."""
loc: Float[Array, " D"]
@abc.abstractmethod
def covariance_operator(self) -> lx.AbstractLinearOperator: ...
def _log_prob(self, x, condition=None):
"""gaussx.gaussian_log_prob(self.loc, self.covariance_operator(), x)."""
def _sample(self, key, condition=None):
"""gaussx.sample_mvn(self.loc, self.covariance_operator(), key=key)[0]."""
class StructuredGaussian(AbstractOperatorGaussian):
"""𝒩(μ, Σ) for a given structured operator, whose array leaves are trainable."""
covariance: lx.AbstractLinearOperator
def covariance_operator(self):
return self.covarianceLowRankGaussian replaces GaussianPCA. It holds the low-rank parameters and builds its operator from them; it has no maths of its own.
NoiseKind = Literal["isotropic", "diagonal"]
class LowRankGaussian(AbstractOperatorGaussian):
"""𝒩(μ, W Wᵀ + Ψ): probabilistic PCA with isotropic Ψ, factor analysis with diagonal Ψ."""
loc: Float[Array, " D"]
W: Float[Array, "D K"]
# one entry for "isotropic", D entries for "diagonal"
log_noise_scale: Float[Array, " P"]
noise: NoiseKind = eqx.field(static=True)
eps: float = eqx.field(static=True)
shape: tuple[int]
cond_shape: None = None
def __init__(self, key, event_shape, rank, *, noise="isotropic", loc=0.0,
log_noise_scale_init=0.0, W_init_scale=0.1, eps=1e-12): ...
def covariance_operator(self) -> gx.LowRankUpdate:
"""Σ = W Wᵀ + Ψ as gaussx.low_rank_plus_diag(ψ, W), with ψ = exp(2 log s) + eps."""
def covariance(self) -> Float[Array, "D D"]:
"""The dense Σ, for tests and small D."""A precision-defined base wraps one of gaussx’s GMRF modules, the way NumpyroBase (moving to pyrox-flows) wraps a NumPyro distribution:
class GaussianFieldLike(Protocol):
"""What GMRFBase uses: GaussianMRF, IntrinsicGMRF, BYM2GMRF and ConstrainedGMRF all fit."""
def event_shape(self) -> tuple[int]: ...
def log_prob(self, value: Float[Array, "*sample N"]) -> Float[Array, "*sample"]: ...
def sample(self, key, sample_shape: tuple[int, ...] = ()) -> Float[Array, "*sample N"]: ...
class GMRFBase(AbstractDistribution):
"""A flowjax base over a gaussx Gaussian Markov random field; event shape (N,)."""
field: GaussianFieldLike
shape: tuple[int]
cond_shape: None = None
def _log_prob(self, x, condition=None):
"""self.field.log_prob(x)."""
def _sample(self, key, condition=None):
"""self.field.sample(key)."""The field’s array leaves (μ, and the arrays inside its precision, such as κ and τ) are trainable like any other flow parameter. An intrinsic field is improper; it is a valid base for density evaluation on the constrained subspace only, and GMRFBase refuses IntrinsicGMRF with constraint="none".
The old GaussianPCA(key, event_shape, latent_dim, log_sigma_init=…) is LowRankGaussian(key, event_shape, rank, log_noise_scale_init=…) with the default noise="isotropic"; σ is the noise scale s.
The public names and constructors of GaussianMixture, ClassCondDiagGaussian, ConditionalDiagGaussian and the info_theory functions do not change; only their bodies do.
GaussianMixture’s full-covariance mode builds each component’s covariance as an operator from its Cholesky factor and calls gaussian_log_prob; its diagonal mode does not change.
info_theory.gaussian_entropy, gaussian_kl_divergence, gaussian_total_correlation and gaussian_mutual_information accept a lineax operator as well as a dense array (GG-O1); an array is wrapped as a PSD-tagged operator, and both call gaussx.
A new distribution gives normalizing_kalman_filter a base gauss_flows owns:
class LinearGaussianSSM(AbstractDistribution):
"""p(y_1:T) of a linear-Gaussian state-space model; event shape (T, M)."""
# each may carry a leading T axis for a time-varying model (GG-O2)
transition: Float[Array, "*T N N"]
obs_model: Float[Array, "*T M N"]
process_noise: Float[Array, "*T N N"]
obs_noise: Float[Array, "*T M M"]
init_mean: Float[Array, " N"]
init_cov: Float[Array, "N N"]
shape: tuple[int, int]
cond_shape: tuple[int, int] | None
def _log_prob(self, y, condition=None):
"""gaussx.kalman_filter(..., y, ..., mask=condition).log_likelihood."""
def _sample(self, key, condition=None):
"""Ancestral sampling of s_1:T then y_1:T by jax.lax.scan."""
@classmethod
def from_sde(cls, kernel: gx.SDEKernel, times: Float[Array, " T"], obs_noise,
*, masked: bool = False) -> LinearGaussianSSM:
"""A Gaussian process over `times`: A_t, Q_t = kernel.discretise_sequence(Δ),
H = kernel.sde_params().H, P_0 = kernel.initial_covariance(), event (T, 1)."""With masked=True at construction, cond_shape is (T, M) and the condition is the boolean observation mask, which is the contract normalizing_kalman_filter already uses to recognise a masked base.
9API usage examples¶
The running example is a 50-dimensional vector of standardised retrieval residuals whose correlations are close to rank 5, and a 4-channel time series of 8 steps for the Kalman flow. The markers name the issues under Follow-up issues.
import gaussx as gx
import jax.numpy as jnp
import jax.random as jr
import gauss_flows as gf
# Shapes: D = 50 event dims; K = 5 rank; T = 8 steps; M = 4 channels;
# G = 64 × 64 grid cells; S = 365 daily steps
# proposed (G2)
# probabilistic PCA: x ~ 𝒩(μ, W Wᵀ + σ² I)
# event (D,)
pca_base = gf.LowRankGaussian(jr.key(0), event_shape=(50,), rank=5)
# proposed (G2)
# factor analysis: x ~ 𝒩(μ, W Wᵀ + diag(ψ))
# event (D,)
fa_base = gf.LowRankGaussian(jr.key(1), event_shape=(50,), rank=5, noise="diagonal")
# proposed (G2)
# log 𝒩(x; μ, W Wᵀ + Ψ) through gx.low_rank_plus_diag and gx.gaussian_log_prob
# (D,) → ()
log_density = fa_base.log_prob(jnp.zeros(50))
# proposed (G4)
# s_t = A s_{t−1} + q_t, y_t = H s_t + v_t
# event (T, M)
ssm = gf.LinearGaussianSSM(
transition=0.9 * jnp.eye(4), obs_model=jnp.eye(4),
process_noise=0.1 * jnp.eye(4), obs_noise=0.1 * jnp.eye(4),
init_mean=jnp.zeros(4), init_cov=jnp.eye(4), n_steps=8,
)
# today (gauss_flows)
# the warp lifted over the T steps of the base
# event (T, M)
nkf = gf.normalizing_kalman_filter(ssm, warp)
# today* (gaussx)
# Λ = Matérn SPDE precision on the grid, α = 2, κ = 0.2 per cell, τ = 1
# (G, G) precision operator
precision = gx.spde_precision_grid((64, 64), kappa=0.2, tau=1.0, alpha=2)
# proposed (G6)
# x ~ 𝒩(0, Λ⁻¹), a Matérn field as the base of a flow over the grid
# event (G,)
field_base = gf.GMRFBase(gx.GaussianMRF(jnp.zeros(64 * 64), precision))
# proposed (G5)
# x ~ 𝒩(0, toeplitz(t)), a stationary daily series with an AR(1)-like covariance
# event (S,)
lags = jnp.arange(365.0)
series_base = gf.StructuredGaussian(loc=jnp.zeros(365),
covariance=gx.Toeplitz(0.8 ** lags))
# proposed (G4)
# a Matérn-3/2 Gaussian process observed at irregular times with noise R = 0.01
# event (T, 1)
times = jnp.sort(jr.uniform(jr.key(2), (8,)) * 30.0)
gp_base = gf.LinearGaussianSSM.from_sde(gx.MaternSDE(order=1), times, obs_noise=0.01)warp is any (M,) bijection, as in the function’s own docstring. The GaussianMRF, Toeplitz and MaternSDE constructor arguments are sketched (today*); check their signatures before reusing the block.
10Gates¶
| Gate | Passes when |
|---|---|
| G-G1 low rank | equals the dense density to 1e-5 |
| G-G2 mixture | equals dense components to 1e-5 |
| G-G3 info theory | equals closed forms to 1e-5 |
| G-G4 Kalman | doctest runs; log-likelihood matches gaussx |
| G-G5 cost | low-rank log-density within 1.5× of today |
| G-G6 skips | no gaussx test skips in CI |
| G-G7 environment | gauss_flows suite passes on the new lock |
| G-G8 structured | dense reference to 1e-5; no D × D formed |
| G-G9 GMRF | equals the wrapped field; flow log-density adds up |
G-G1 low rank. For D = 50 and K = 5, LowRankGaussian.log_prob equals jax.scipy.stats.multivariate_normal.logpdf with the dense W Wᵀ + Ψ to 1e-5 relative in float32: with isotropic noise for σ² ∈ {0.1, 1, 10}, and with diagonal noise for ψ drawn log-uniformly over [0.1, 10]. Samples from 10⁵ draws have a sample covariance within 3 standard errors of Σ in every entry. Today’s GaussianPCA fails the isotropic case for σ² ≠ 1 (gauss_flows#138).
G-G2 mixture. The full-covariance mixture equals a log-sum-exp of dense per-component multivariate_normal.logpdf to 1e-5, for 3 components in 6 dimensions.
G-G3 info theory. gaussian_entropy, gaussian_kl_divergence, gaussian_total_correlation and gaussian_mutual_information equal their closed forms on dense matrices to 1e-5, on random SPD matrices with condition numbers up to 10³.
G-G4 Kalman. The normalizing_kalman_filter example runs as a doctest with LinearGaussianSSM, and with an identity warp its log_prob equals gaussx.kalman_filter(...).log_likelihood to 1e-5, masked and unmasked. LinearGaussianSSM.from_sde with a Matérn-3/2 kernel at 50 irregular times equals the dense Gaussian-process marginal likelihood 𝒩(y; 0, K + R I) with the Matérn-3/2 kernel matrix K to 1e-4 relative in float32.
G-G5 cost. At D = 1000 and K = 10, the jitted LowRankGaussian.log_prob takes at most 1.5 times the time of today’s hand-written GaussianPCA.log_prob, measured after warm-up (the 1.5 is an estimate of what structural dispatch should cost).
G-G6 skips. CI reports zero skipped tests in tests/test_flows_conjugate_filter.py, and _require_gaussx is gone.
G-G7 environment. gauss_flows’s full test suite passes after declaring gaussx and moving to its floors (jax 0.10 or newer, equinox 0.13.8, lineax 0.1.1).
G-G8 structured. For Toeplitz, Kronecker (two factors), KroneckerSum and BlockTriDiag covariances at D ≈ 256, StructuredGaussian.log_prob equals multivariate_normal.logpdf with the dense matrix to 1e-5 relative, and 10⁵ samples have a sample covariance within 3 standard errors of Σ in every entry. At D = 4096 the jaxpr of the jitted log_prob and sample contains no array of shape (D, D) for any of the four. A structure that fails the last check is reported in gaussx and listed in the docstring as dense.
G-G9 GMRF. GMRFBase.log_prob and sample equal the wrapped GaussianMRF’s to 1e-6 on a 32 × 32 Matérn grid, and a flowjax Transformed of GMRFBase with an affine bijection has a log-density equal to the dense change-of-variables formula to 1e-5.
11Risks¶
The dependency bump breaks gauss_flows. jax 0.12 may break its numpyro, flowjax or diffrax use. Fallback: pin jax to gaussx’s floor, 0.10.
gaussx is slower on a structure it does not recognise. Fallback: pass gaussx an explicit solver for that operator, or keep the hand-written path behind gate G-G5 and file the dispatch gap in gaussx.
gaussx changes its API under gauss_flows. gaussx releases often (v0.8.4 on 28 Nov 2026). Mitigation: gauss_flows pins a gaussx tag, as it pins functax, and moves it deliberately with geostack’s pin.
A structure falls back to dense algebra. gaussx’s
gaussian_log_probmay form Σ for a structure it does not dispatch, which is silent and O(D³). Fallback: gate G-G8 finds it; the structure is filed in gaussx and documented as dense inStructuredGaussian.The skipped tests fail once they run. They have not run in CI since the guard went in. Fallback: fix them in the dependency issue, which is where they start running.
12Follow-up issues¶
Filed on 1 Dec 2026: the draft IDs below map to issue numbers in the Filed issues table of the gauss_flows layout page.
Each issue is written to be self-contained when filed. The epic lives in gauss_flows, where all but one issue’s code changes.
| ID | Repo | Title |
|---|---|---|
| E | gauss_flows | [EPIC] gauss_flows takes its Gaussian maths from gaussx |
| S2 | geostack | chore(stack): drop gauss_flows's undeclared-gaussx exception |
| G1 | gauss_flows (models) | deps: declare gaussx as a base dependency and move to its jax and lineax floors |
| G2 | gauss_flows (models) | distributions: LowRankGaussian replaces GaussianPCA, and the full-covariance mixture runs on gaussx |
| G3 | gauss_flows (models) | info_theory: Gaussian entropy and KL divergence from gaussx |
| G4 | gauss_flows (models) | flows: a LinearGaussianSSM base on gaussx for the normalizing Kalman filter, with a Gaussian-process constructor |
| G5 | gauss_flows (models) | distributions: StructuredGaussian, a base for any gaussx covariance operator |
| G6 | gauss_flows (models) | distributions: GMRFBase, a base over gaussx's Gaussian Markov random fields |
Order. G1 goes first: it declares gaussx, removes _require_gaussx, turns the skipped tests on and regenerates the dependency guard. S2 lands with it, since geostack’s check and gauss_flows’s guard carry the same list. G2, G3, G4 and G6 need only G1 and run in parallel. G5 follows G2, because G2 introduces AbstractOperatorGaussian, which both LowRankGaussian and StructuredGaussian subclass.
Existing issues. G2 closes gauss_flows#138, since the class that has the bug is removed and its replacement passes G-G1. gauss_flows#114 (a faster inverse for MixtureGaussianCDF) stays a separate issue. Its root finder moves first: gauss_flows#166 (filed as argminax#110), re-aimed by the gauss_flows layout (its L3), puts gaussx’s bracketed inverse and its Chandrupatla solver into gauss-flows-maps as monotone_inverse, gaussx#905 removes them from gaussx, and pyrox#590 moves pyrox-nn’s predictive quantiles onto it. gauss_flows’s own bisection_inverse helper (utils.py, used by MixtureGaussianCDF and MixtureLogisticCDF) and the optimistix.Bisection loops in the mixture-CDF and deep-sigmoid couplings can then use monotone_inverse; it would be called at gauss_flows’s tolerance, since its default rtol=1e-4 is looser than the 1e-6 gauss_flows uses.
With the companion page. Both pages bump gauss_flows’s environment. Whichever dependency issue lands first (G1 here, F1 there) takes the jax, equinox and functax bump, and the other only adds its library.
13NumPyro bridges move to pyrox-flows¶
gauss_flows depends on numpyro only for three bridge modules, which move to a new pyrox workspace package, pyrox-flows (decided 1 Dec 2026):
| Bridge | Lines | Issue |
|---|---|---|
NumpyroBase | 142 | pyrox#591 |
FlowDist | 80 | replaced by flowjax’s own bridge |
FlowGuide | 104 | pyrox#591 |
gauss_flows#165 then removes them and drops numpyro from gauss_flows’s dependencies; it is blocked by pyrox#591. The two open issues about FlowGuide moved with them: pyrox#592 (was gauss_flows#154) and pyrox#593 (NeuTra, was gauss_flows#133).
This follows the stack’s rule that probabilistic programming lives in pyrox, as gaussx’s NumPyro distributions moved to pyrox-gauss in gaussx#846. pyrox (GeoML tier 2) may import gauss_flows, and pyrox-flows stays at pyrox’s own tier, because gauss_flows will sit at tier 1.
What it changes on this page. G4’s LinearGaussianSSM becomes the base that tests/test_flows_kalman.py uses in place of NumpyroBase, so gauss_flows#165 should land after G4, or keep a local test double until it does. The GMRF wrapper G6 follows NumpyroBase’s pattern but needs no NumPyro, so it stays in gauss_flows. A numpyro-free gauss_flows is also the precondition for splitting a small core package of maps out of gauss_flows (an idea raised on the gauss_flows reparametrisation page’s thread, not yet decided).
14Open questions¶
Both questions were decided on 1 Dec 2026, and the API proposal follows them.
GG-O1. Should
info_theorytake lineax operators as well as arrays? Decided 1 Dec 2026: yes, as an additional input type, so a structured covariance stays structured; a dense array is wrapped as a PSD-tagged operator, as before.GG-O2. Should
LinearGaussianSSMtake time-varying matrices? Decided 1 Dec 2026: yes, sincegaussx.kalman_filteralready accepts a leading T axis on every matrix; a time-invariant model passes matrices without that axis.
15References¶
Tipping, M. E. and Bishop, C. M. (1999). Probabilistic principal component analysis. Journal of the Royal Statistical Society B, 61(3), 611–622.
Bishop, C. M. (2006). Pattern Recognition and Machine Learning, section 12.2.4 (factor analysis). Springer.
de Bézenac, E., Rangapuram, S. S., Benidis, K., Bohlke-Schneider, M., Kurle, R., Stella, L., Hasson, H., Gallinari, P. and Januschowski, T. (2020). Normalizing Kalman filters for multivariate time series analysis. NeurIPS.
Lindgren, F., Rue, H. and Lindström, J. (2011). An explicit link between Gaussian fields and Gaussian Markov random fields: the stochastic partial differential equation approach. Journal of the Royal Statistical Society B, 73(4), 423–498.
Särkkä, S. and Solin, A. (2019). Applied Stochastic Differential Equations. Cambridge University Press.