jaxrens.sampling.run_loop

Unified outer NS loop: _run_loop and its private helpers.

This module is commit 4 of the nested_sampling.py modularisation plan. Both run_ns and run_ns_parallel are thin wrappers that call _run_loop after initialising the descriptor- and manager-level objects.

The helpers _bump_cumulative_counters, _inject_cumulative_into_info, _pack_adjustment_info, and _dispatch_callbacks were previously private to nested_sampling.py; they now live here. nested_sampling.py imports them from here.

Design invariants

  • _run_loop is pure-Python control flow; every JAX call inside it is either already JIT-compiled (jit_ns_step from batcher.wrap_step) or is a Python-level numpy / host operation.

  • The descriptor carries all shape differences (single vs. vmap); there is NO isinstance sniffing inside _run_loop.

  • Overflow retry preserves the invariant that the iteration counter only advances after a successful step.

Classes

NSCallback

The hooks an NS loop callback may implement.