UltraNest
Data Structures | Functions
ultranest.h File Reference
#include "common.h"

Go to the source code of this file.

Data Structures

struct  ultranest_results
 

Functions

ultranest_results ultranest (LikelihoodFunc, const char *root, const int ndim, const int max_samples, const double logZtol, const int nlive_points, unsigned int nsteps)
 

Detailed Description

Author
Johannes Buchner
Date
2014

Function Documentation

ultranest_results ultranest ( LikelihoodFunc  ,
const char *  root,
const int  ndim,
const int  max_samples,
const double  logZtol,
const int  nlive_points,
unsigned int  nsteps 
)

Run UltraNest.

Parameters
LikeLikelihood function. For example
void MyLike(double * Cube, int * ndim, int * nparams, double * lnew, void * userparams) {
// do a transformation of variables
Cube[0] = Cube[0] * 2;
// compute and store likelihood
*lnew = pow((Cube[0] - 0.3) / 0.01, 2);
}
Parameters
rootprefix for output files
ndimdimensionality of the problem
max_samplesmaximum number of likelihood evaluations to perform Set to -1 to not set a limit.
logZtoltolerance on the evidence to achieve (e.g. log(10)). Once this tolerance is achieved, integration is done. Higher values mean the integration finishes earlier.
nlive_pointsnumber of live points to use Use 50 for a quick look, 400 or 1000 for a real, typical problem.
nstepsnumber of MCMC proposal steps
Returns
a ultranest_results structure with the results.

Additionally, the results are written to files:

<root>posterior_samples.txt: Contains coordinates, likelihood and weights as a table. <root>evidence.txt: Contains 4 lines, with one number each: evidence, uncertainty, number of iterations and the number of likelihood evaluations.

Additional output files are produces so a run can be continued.

Uses ultranest_draw_init, ultranest_sampler_init, ultranest_sampler_next and ultranest_sampler_integrate_remainder

References ultranest_results::H, point::L, ultranest_state::Lmax, ultranest_results::logZ, ultranest_results::logZerr, ultranest_state::ndim, ultranest_results::ndraws, ultranest_state::ndraws, ultranest_results::niter, ultranest_state::nlive_points, ultranest_state::remainderZ, ultranest_state::remainderZerr, ultranest_results::root, ultranest_draw_init(), ultranest_sampler_init(), ultranest_sampler_integrate_remainder(), ultranest_sampler_next(), and ultranest_results::weighted_points.

Referenced by main().