Skip to content

Conversation

@yallup
Copy link
Collaborator

@yallup yallup commented Jul 24, 2025

Fix numerical stability and performance in nested sampling utils

Changes

Numerical stability fix in logX:

  • Handle precision limits when log_diff = 0.0 by replacing with log(eps) to avoid -inf from log1mexp(0)
  • Eliminates NaN/infinite values in high-dimensional cases for both 32-bit and 64-bit precision
  • Uses -ve exponential over log(uniform)

Performance optimization in finalise:

  • Direct concatenation of scalar fields instead of using tree_map

Fixes numerical issues reported in high-dimensional nested sampling runs.

@yallup yallup changed the title attempt to clean up log weights implementation for high dim edge cases Log weight stabilisation Jul 24, 2025
@AdamOrmondroyd
Copy link

AdamOrmondroyd commented Aug 27, 2025

Making a note here that I'm getting slightly different evidences from this branch than the nested_sampling (main) branch with my BAO and SNe, nested_sampling matches polychord.

Appreciate this isn't a helpful mwe but didn't want to forget

yallup added a commit that referenced this pull request Oct 20, 2025
Adding to Slice refactor by including some additional standalone slicing compatibility, also merging changes from #27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants