jaxrens.prior_mass

Prior-mass bookkeeping for nested sampling with n_cull >= 1.

Single source of truth for the prior-mass ladder X_n and the dead-point weights a_n, shared by the in-JIT evidence accumulator (jaxrens.sampling.nested_sampling), the termination criteria (jaxrens.sampling.termination) and post-processing (jaxrens.postprocess.thermodynamics).

Convention follows pymatnest’s ns_analyse.calc_log_a (SENS paper, Martiniani et al., PRX 4, 031034 (2014), Eq. 3, doi:10.1103/PhysRevX.4.031034). With K live walkers and n_cull walkers removed per iteration (the paper writes P for n_cull; jaxrens reserves P for the replicas-per-GPU axis), dead point n (0-indexed over the global, per-cull sequence; within an iteration the culled walkers are ordered by descending energy) carries

\[ \begin{align}\begin{aligned}\log X_n = \sum_{i=0}^{n} \left[\log(K - i \bmod n_\mathrm{cull}) - \log(K + 1 - i \bmod n_\mathrm{cull})\right]\\\log a_n = \log X_n - \log(K + 1 - (n+1) \bmod n_\mathrm{cull})\end{aligned}\end{align} \]

so one full iteration contracts the prior mass by (K + 1 - n_cull) / (K + 1). After D dead points each of the K live walkers carries X_D / K (X_D with D + 1 terms, matching the one-step shift of a_n = X_n - X_{n+1}), so dead + live weights sum to the constant X_0.

NumPy only — imported by the JAX-free post-processing path.

Functions

check_n_cull

Raise if (n_live, n_cull) do not define a valid prior-mass ladder.

iteration_offsets

Within-iteration offsets for closed-form weights at any iteration.

log_alpha

Log prior-mass contraction per iteration, log((K + 1 - n_cull) / (K + 1)).

log_dead_weights

log a_n for dead points 0 <= n < n_dead; shape (n_dead,).

log_live_weight

Log weight carried by each live walker after n_dead dead points.

log_prior_mass

log X_n for dead points 0 <= n < n_dead; shape (n_dead,).