LALInference  4.1.6.1-89842e6
LALInferenceNestedSampler.c File Reference

Prototypes

static int _saveNSintegralStateH5 (LALH5File *group, NSintegralState *s)
 Utility functions for the resume functionality. More...
 
static int _loadNSintegralStateH5 (LALH5File *group, NSintegralState *s)
 
static int ReadNSCheckPointH5 (char *filename, LALInferenceRunState *runState, NSintegralState *s)
 
static int WriteNSCheckPointH5 (char *filename, LALInferenceRunState *runState, NSintegralState *s)
 
static int CheckOutputFileContents (char *filename)
 
static int syncLivePointsDifferentialPoints (LALInferenceRunState *state, LALInferenceThreadState *thread)
 Sync the live points to the differential evolution buffer. More...
 
static void catch_interrupt (UNUSED int sig, UNUSED siginfo_t *siginfo, UNUSED void *context)
 
static void catch_alarm (UNUSED int sig, UNUSED siginfo_t *siginfo, UNUSED void *context)
 
static void install_resume_handler (int checkpoint_exit)
 Install the signal handlers for checkpointing. More...
 
static UINT4 UpdateNMCMC (LALInferenceRunState *runState)
 
static REAL8 LALInferenceNSSample_logt (int Nlive, gsl_rng *RNG)
 
static REAL8 mean (REAL8 *array, int N)
 
static void LALInferenceNScalcCVM (gsl_matrix **cvm, LALInferenceVariables **Live, UINT4 Nlive)
 Calculate covariance matrix from a collection of live points. More...
 
static double logsubexp (double a, double b)
 
static void SetupEigenProposals (LALInferenceRunState *runState)
 
static REAL8 incrementEvidenceSamples (gsl_rng *GSLrandom, UINT4 Nlive, REAL8 logL, NSintegralState *s)
 Update the internal state of the integrator after receiving the lowest logL value logL. More...
 
static void printAdaptiveJumpSizes (FILE *file, LALInferenceThreadState *threadState)
 
static NSintegralStateinitNSintegralState (UINT4 Nruns, UINT4 Nlive)
 
void LALInferenceNestedSamplingAlgorithmInit (LALInferenceRunState *runState)
 Initialise the nested sampling algorithm by reading from the commandLine and setting up algorithmParams. More...
 
void LALInferenceNestedSamplingAlgorithm (LALInferenceRunState *runState)
 NestedSamplingAlgorithm implements the nested sampling algorithm, see e.g. More...
 
LALInferenceVariablesLALInferenceComputeAutoCorrelation (LALInferenceRunState *runState, UINT4 max_iterations, LALInferenceEvolveOneStepFunction evolve)
 Compute the autocorrelation length from the sampler at the current global iteration. More...
 
UINT4 LALInferenceMCMCSamplePrior (LALInferenceRunState *runState)
 Perform one MCMC iteration on runState->currentParams. More...
 
UINT4 LALInferenceMCMCSamplePriorNTimes (LALInferenceRunState *runState, UINT4 N)
 Sample the prior N times, returns number of acceptances. More...
 
void LALInferenceProjectSampleOntoEigenvectors (LALInferenceVariables *params, gsl_matrix *eigenvectors, REAL8Vector **projection)
 Project the sample in params onto the eigenvectors given in eigenvectors. More...
 
INT4 LALInferenceNestedSamplingCachedSampler (LALInferenceRunState *runState)
 
INT4 LALInferenceNestedSamplingSloppySample (LALInferenceRunState *runState)
 Sample the limited prior distribution using the MCMC method as usual, but run a sub-chain of x iterations which doesn't check the likelihood bound. More...
 
INT4 LALInferenceNestedSamplingOneStep (LALInferenceRunState *runState)
 A single iteration of the NS algorithm. More...
 
void LALInferenceSetupLivePointsArray (LALInferenceRunState *runState)
 Setup the live points by calling runState->initVariables on each of them if it is specified. More...
 

Go to the source code of this file.

Data Structures

struct  NSintegralState
 structure holding internal state of the NS integrator More...
 

Macros

#define PROGRAM_NAME   "LALInferenceNestedSampler.c"
 
#define CVS_ID_STRING   "$Id$"
 
#define CVS_REVISION   "$Revision$"
 
#define CVS_SOURCE   "$Source$"
 
#define CVS_DATE   "$Date$"
 
#define CVS_NAME_STRING   "$Name$"
 
#define MAX_MCMC   5000 /* Maximum chain length, set to be higher than expected from a reasonable run */
 
#define ACF_TOLERANCE   0.01 /* Desired maximum correlation of MCMC samples */
 

Variables

static int __chainfile_iter
 
static struct itimerval checkpoint_timer
 
static volatile sig_atomic_t __ns_saveStateFlag = 0
 
static volatile sig_atomic_t __ns_exitFlag = 0
 

Macro Definition Documentation

◆ PROGRAM_NAME

#define PROGRAM_NAME   "LALInferenceNestedSampler.c"

Definition at line 30 of file LALInferenceNestedSampler.c.

◆ CVS_ID_STRING

#define CVS_ID_STRING   "$Id$"

Definition at line 31 of file LALInferenceNestedSampler.c.

◆ CVS_REVISION

#define CVS_REVISION   "$Revision$"

Definition at line 32 of file LALInferenceNestedSampler.c.

◆ CVS_SOURCE

#define CVS_SOURCE   "$Source$"

Definition at line 33 of file LALInferenceNestedSampler.c.

◆ CVS_DATE

#define CVS_DATE   "$Date$"

Definition at line 34 of file LALInferenceNestedSampler.c.

◆ CVS_NAME_STRING

#define CVS_NAME_STRING   "$Name$"

Definition at line 35 of file LALInferenceNestedSampler.c.

◆ MAX_MCMC

#define MAX_MCMC   5000 /* Maximum chain length, set to be higher than expected from a reasonable run */

Definition at line 37 of file LALInferenceNestedSampler.c.

◆ ACF_TOLERANCE

#define ACF_TOLERANCE   0.01 /* Desired maximum correlation of MCMC samples */

Definition at line 38 of file LALInferenceNestedSampler.c.

Function Documentation

◆ _saveNSintegralStateH5()

static int _saveNSintegralStateH5 ( LALH5File group,
NSintegralState s 
)
static

Utility functions for the resume functionality.

Write the current state to a checkpoint file the given filename Read the given filename to populate a given LALInferenceRunState and NSintegralState

Definition at line 68 of file LALInferenceNestedSampler.c.

◆ _loadNSintegralStateH5()

static int _loadNSintegralStateH5 ( LALH5File group,
NSintegralState s 
)
static

Definition at line 81 of file LALInferenceNestedSampler.c.

◆ ReadNSCheckPointH5()

static int ReadNSCheckPointH5 ( char filename,
LALInferenceRunState runState,
NSintegralState s 
)
static

Definition at line 164 of file LALInferenceNestedSampler.c.

◆ WriteNSCheckPointH5()

static int WriteNSCheckPointH5 ( char filename,
LALInferenceRunState runState,
NSintegralState s 
)
static

Definition at line 98 of file LALInferenceNestedSampler.c.

◆ CheckOutputFileContents()

static int CheckOutputFileContents ( char filename)
static

Definition at line 145 of file LALInferenceNestedSampler.c.

◆ syncLivePointsDifferentialPoints()

static int syncLivePointsDifferentialPoints ( LALInferenceRunState state,
LALInferenceThreadState thread 
)
static

Sync the live points to the differential evolution buffer.

Definition at line 1738 of file LALInferenceNestedSampler.c.

◆ catch_interrupt()

static void catch_interrupt ( UNUSED int  sig,
UNUSED siginfo_t *  siginfo,
UNUSED void *  context 
)
static

Definition at line 230 of file LALInferenceNestedSampler.c.

◆ catch_alarm()

static void catch_alarm ( UNUSED int  sig,
UNUSED siginfo_t *  siginfo,
UNUSED void *  context 
)
static

Definition at line 239 of file LALInferenceNestedSampler.c.

◆ install_resume_handler()

static void install_resume_handler ( int  checkpoint_exit)
static

Install the signal handlers for checkpointing.

If checkpoint_exit!=0, then install the catch_alarm_condor_exit_code handler to exit after checkpointing

Definition at line 250 of file LALInferenceNestedSampler.c.

◆ UpdateNMCMC()

static UINT4 UpdateNMCMC ( LALInferenceRunState runState)
static

Definition at line 402 of file LALInferenceNestedSampler.c.

◆ LALInferenceNSSample_logt()

static REAL8 LALInferenceNSSample_logt ( int  Nlive,
gsl_rng *  RNG 
)
static

Definition at line 395 of file LALInferenceNestedSampler.c.

◆ mean()

static REAL8 mean ( REAL8 array,
int  N 
)
static

Definition at line 387 of file LALInferenceNestedSampler.c.

◆ LALInferenceNScalcCVM()

static void LALInferenceNScalcCVM ( gsl_matrix **  cvm,
LALInferenceVariables **  Live,
UINT4  Nlive 
)
static

Calculate covariance matrix from a collection of live points.

Definition at line 448 of file LALInferenceNestedSampler.c.

◆ logsubexp()

static double logsubexp ( double  a,
double  b 
)
static

Definition at line 301 of file LALInferenceNestedSampler.c.

◆ SetupEigenProposals()

static void SetupEigenProposals ( LALInferenceRunState runState)
static

Definition at line 1676 of file LALInferenceNestedSampler.c.

◆ incrementEvidenceSamples()

static REAL8 incrementEvidenceSamples ( gsl_rng *  GSLrandom,
UINT4  Nlive,
REAL8  logL,
NSintegralState s 
)
static

Update the internal state of the integrator after receiving the lowest logL value logL.

Definition at line 321 of file LALInferenceNestedSampler.c.

◆ printAdaptiveJumpSizes()

static void printAdaptiveJumpSizes ( FILE *  file,
LALInferenceThreadState threadState 
)
static

Definition at line 343 of file LALInferenceNestedSampler.c.

◆ initNSintegralState()

static NSintegralState * initNSintegralState ( UINT4  Nruns,
UINT4  Nlive 
)
static

Definition at line 365 of file LALInferenceNestedSampler.c.

Variable Documentation

◆ __chainfile_iter

int __chainfile_iter
static

Definition at line 46 of file LALInferenceNestedSampler.c.

◆ checkpoint_timer

struct itimerval checkpoint_timer
static

Definition at line 46 of file LALInferenceNestedSampler.c.

◆ __ns_saveStateFlag

volatile sig_atomic_t __ns_saveStateFlag = 0
static

Definition at line 223 of file LALInferenceNestedSampler.c.

◆ __ns_exitFlag

volatile sig_atomic_t __ns_exitFlag = 0
static

Definition at line 225 of file LALInferenceNestedSampler.c.