Top |
gboolean | auto-trim | Read / Write / Construct |
guint | auto-trim-div | Read / Write / Construct |
char * | data-file | Read / Write |
NcmFit * | fit | Read / Write / Construct Only |
NcmObjArray * | function-array | Read / Write / Construct Only |
guint | intermediary-log | Read / Write / Construct |
double | log-time-interval | Read / Write / Construct |
double | lre-step | Read / Write / Construct |
double | max-runs-time | Read / Write / Construct |
guint | min-runs | Read / Write / Construct |
NcmFitRunMsgs | mtype | Read / Write |
guint | nthreads | Read / Write |
guint | nwalkers | Read / Write / Construct Only |
NcmMSetTransKern * | sampler | Read / Write / Construct |
gboolean | skip-check | Read / Write / Construct |
NcmMSetCatalogTrimType | trim-type | Read / Write / Construct |
gboolean | use-mpi | Read / Write / Construct |
NcmFitESMCMCWalker * | walker | Read / Write / Construct Only |
#define | NCM_TYPE_FIT_ESMCMC |
#define | NCM_FIT_ESMCMC_MIN_SYNC_INTERVAL |
#define | NCM_FIT_ESMCMC_M2LNL_ID |
#define | NCM_FIT_ESMCMC_MPI_IN_LEN |
#define | NCM_FIT_ESMCMC_MPI_OUT_LEN |
NcmFitESMCMC |
NcmFitESMCMC is a class that implements the Ensemble sampler Markov Chain Monte Carlo analysis. The object requires a NcmFit object to be set before running the analysis. The initial points are sampled from a NcmMSetTransKern object. The walkers are defined by a NcmFitESMCMCWalker object.
The NcmFitESMCMC object can be run in parallel using MPI.
NcmFitESMCMC * ncm_fit_esmcmc_new (NcmFit *fit
,guint nwalkers
,NcmMSetTransKern *sampler
,NcmFitESMCMCWalker *walker
,NcmFitRunMsgs mtype
);
Creates a new NcmFitESMCMC object using the given parameters.
fit |
a NcmFit |
|
nwalkers |
number of walkers |
|
sampler |
inital points sampler NcmMSetTransKern |
|
walker |
[allow-none] | |
mtype |
NcmFitESMCMC * ncm_fit_esmcmc_new_funcs_array (NcmFit *fit
,guint nwalkers
,NcmMSetTransKern *sampler
,NcmFitESMCMCWalker *walker
,NcmFitRunMsgs mtype
,NcmObjArray *funcs_array
);
Creates a new NcmFitESMCMC object using the given parameters.
The funcs_array
is used to compute extra columns in the catalog.
The functions must be scalar and constant.
fit |
a NcmFit |
|
nwalkers |
number of walkers |
|
sampler |
inital points sampler NcmMSetTransKern |
|
walker |
[allow-none] | |
mtype |
||
funcs_array |
a NcmObjArray of scalar functions to include in the catalog. |
NcmFitESMCMC *
ncm_fit_esmcmc_ref (NcmFitESMCMC *esmcmc
);
Increases the reference count of esmcmc
by one.
void
ncm_fit_esmcmc_free (NcmFitESMCMC *esmcmc
);
Decreases the reference count of esmcmc
by one. If the reference
count reaches zero, all memory allocated by the object is released.
void
ncm_fit_esmcmc_clear (NcmFitESMCMC **esmcmc
);
Decreases the reference count of esmcmc
by one. If the reference
count reaches zero, all memory allocated by the object is released.
The esmcmc
pointer is set to NULL
.
void ncm_fit_esmcmc_set_data_file (NcmFitESMCMC *esmcmc
,const gchar *filename
);
Sets the data file to use for the chains catalog.
void ncm_fit_esmcmc_set_sampler (NcmFitESMCMC *esmcmc
,NcmMSetTransKern *sampler
);
void ncm_fit_esmcmc_set_mtype (NcmFitESMCMC *esmcmc
,NcmFitRunMsgs mtype
);
Sets the type of messages to use when running.
void ncm_fit_esmcmc_set_nthreads (NcmFitESMCMC *esmcmc
,guint nthreads
);
If nthreads
is larger than nwalkers / 2, it will be set to
nwalkers / 2.
void ncm_fit_esmcmc_use_mpi (NcmFitESMCMC *esmcmc
,gboolean use_mpi
);
If use_mpi
is TRUE then the parallelization will be accomplished
using MPI if any slaves are available. If no slaves are available
then it falls back to threads.
Note that parallelization will only occur if the number of threads
set using ncm_fit_esmcmc_set_nthreads()
is larger than one.
void ncm_fit_esmcmc_set_rng (NcmFitESMCMC *esmcmc
,NcmRNG *rng
);
Sets the random number generator to use.
void ncm_fit_esmcmc_set_auto_trim (NcmFitESMCMC *esmcmc
,gboolean enable
);
If enable
is TRUE turns on the auto-trimming when performing a
run_lre.
void ncm_fit_esmcmc_set_auto_trim_div (NcmFitESMCMC *esmcmc
,guint div
);
Sets the divisor for the auto trim tests.
void ncm_fit_esmcmc_set_auto_trim_type (NcmFitESMCMC *esmcmc
,NcmMSetCatalogTrimType ttype
);
Sets the trim type.
void ncm_fit_esmcmc_set_min_runs (NcmFitESMCMC *esmcmc
,guint min_runs
);
Sets the minimum number of runs between tests.
void ncm_fit_esmcmc_set_max_runs_time (NcmFitESMCMC *esmcmc
,gdouble max_runs_time
);
Sets the maximum time for the runs between tests.
void ncm_fit_esmcmc_set_skip_check (NcmFitESMCMC *esmcmc
,gboolean skip_check
);
Set whether to skip the check of the last ensemble in the catalog when continuing a run.
gboolean
ncm_fit_esmcmc_get_skip_check (NcmFitESMCMC *esmcmc
);
Get whether to skip the check of the last ensemble in the catalog when continuing a run.
gdouble
ncm_fit_esmcmc_get_accept_ratio (NcmFitESMCMC *esmcmc
);
The acceptance ratio is the ratio of accepted proposals over the total number of proposals.
gdouble
ncm_fit_esmcmc_get_offboard_ratio (NcmFitESMCMC *esmcmc
);
The offboard ratio is the ratio of offboard proposals over the total number of proposals.
gdouble
ncm_fit_esmcmc_get_accept_ratio_last_update
(NcmFitESMCMC *esmcmc
);
The acceptance ratio is the ratio of accepted proposals over the total number of proposals during the last update.
gdouble
ncm_fit_esmcmc_get_offboard_ratio_last_update
(NcmFitESMCMC *esmcmc
);
The offboard ratio is the ratio of offboard proposals over the total number of proposals during the last update.
void
ncm_fit_esmcmc_start_run (NcmFitESMCMC *esmcmc
);
Starts the run. This method should be called before any other run related method.
void
ncm_fit_esmcmc_end_run (NcmFitESMCMC *esmcmc
);
Terminates the run. This method should be called after all run related methods.
void ncm_fit_esmcmc_run (NcmFitESMCMC *esmcmc
,guint n
);
Runs the Monte Carlo until it reaches the n
-th realization. Note that
if the first_id is non-zero it will run n
- first_id realizations.
void ncm_fit_esmcmc_run_lre (NcmFitESMCMC *esmcmc
,guint prerun
,gdouble lre
);
Runs the ESMCMC algorithm until the least relative error is less than lre
.
It runs at least prerun
pre-runs before starting the algorithm.
void ncm_fit_esmcmc_run_burnin (NcmFitESMCMC *esmcmc
,guint prerun
,guint ntimes
);
Runs the ESMCMC algorithm until the prerun
-th iterations are reached.
Then it runs ntimes
times the estimated constant break.
The constant break is the number of iterations after which the variance of the m2lnL is constant.
void
ncm_fit_esmcmc_mean_covar (NcmFitESMCMC *esmcmc
);
Calculates the mean and covariance of the generated catalog.
NcmSerialize *
ncm_fit_esmcmc_peek_ser (NcmFitESMCMC *esmcmc
);
Peeks the internal NcmSerialize object from esmcmc
.
NcmMSetCatalog *
ncm_fit_esmcmc_get_catalog (NcmFitESMCMC *esmcmc
);
Gets the generated catalog of esmcmc
.
NcmMSetCatalog *
ncm_fit_esmcmc_peek_catalog (NcmFitESMCMC *esmcmc
);
Gets the generated catalog of esmcmc
.
NcmFit *
ncm_fit_esmcmc_peek_fit (NcmFitESMCMC *esmcmc
);
Gets the NcmFit object used by the sampler.
gboolean ncm_fit_esmcmc_validate (NcmFitESMCMC *esmcmc
,gulong pi
,gulong pf
);
Recalculates the value of $-2\ln(L)$ and compares with the values found in the catalog. This function is particularly useful to check if any problem occured during a multithread evaluation of the likelihood.
Choosing pf
== 0 performs the validation from pi
to the end.
NcmFitESMCMCWalker *
ncm_fit_esmcmc_peek_walker (NcmFitESMCMC *esmcmc
);
“auto-trim”
property “auto-trim” gboolean
Whether to automatically trim the catalog.
Owner: NcmFitESMCMC
Flags: Read / Write / Construct
Default value: FALSE
“auto-trim-div”
property “auto-trim-div” guint
Automatically trim divisor.
Owner: NcmFitESMCMC
Flags: Read / Write / Construct
Allowed values: >= 1
Default value: 100
“data-file”
property “data-file” char *
Data filename.
Owner: NcmFitESMCMC
Flags: Read / Write
Default value: NULL
“fit”
property“fit” NcmFit *
Fit object.
Owner: NcmFitESMCMC
Flags: Read / Write / Construct Only
“function-array”
property“function-array” NcmObjArray *
Functions array.
Owner: NcmFitESMCMC
Flags: Read / Write / Construct Only
“intermediary-log”
property “intermediary-log” guint
Number of intermediary logs.
Owner: NcmFitESMCMC
Flags: Read / Write / Construct
Allowed values: >= 1
Default value: 5
“log-time-interval”
property “log-time-interval” double
Time interval between log.
Owner: NcmFitESMCMC
Flags: Read / Write / Construct
Allowed values: >= 1
Default value: 60
“lre-step”
property “lre-step” double
Step size in the lre run.
Owner: NcmFitESMCMC
Flags: Read / Write / Construct
Allowed values: [0.01,1]
Default value: 0.1
“max-runs-time”
property “max-runs-time” double
Maximum time between runs.
Owner: NcmFitESMCMC
Flags: Read / Write / Construct
Allowed values: >= 1
Default value: 7200
“min-runs”
property “min-runs” guint
Minumum number of runs.
Owner: NcmFitESMCMC
Flags: Read / Write / Construct
Allowed values: >= 1
Default value: 10
“mtype”
property“mtype” NcmFitRunMsgs
Run messages type.
Owner: NcmFitESMCMC
Flags: Read / Write
Default value: NCM_FIT_RUN_MSGS_SIMPLE
“nthreads”
property “nthreads” guint
Number of threads to run.
Owner: NcmFitESMCMC
Flags: Read / Write
Default value: 0
“nwalkers”
property “nwalkers” guint
Number of walkers.
Owner: NcmFitESMCMC
Flags: Read / Write / Construct Only
Allowed values: >= 1
Default value: 1
“sampler”
property“sampler” NcmMSetTransKern *
Initial points sampler.
Owner: NcmFitESMCMC
Flags: Read / Write / Construct
“skip-check”
property “skip-check” gboolean
Skip check.
Owner: NcmFitESMCMC
Flags: Read / Write / Construct
Default value: FALSE
“trim-type”
property“trim-type” NcmMSetCatalogTrimType
Trimming tests to apply.
Owner: NcmFitESMCMC
Flags: Read / Write / Construct
Default value: NCM_MSET_CATALOG_TRIM_TYPE_ESS
“use-mpi”
property “use-mpi” gboolean
Use MPI instead of threads.
Owner: NcmFitESMCMC
Flags: Read / Write / Construct
Default value: TRUE
“walker”
property“walker” NcmFitESMCMCWalker *
Walker object.
Owner: NcmFitESMCMC
Flags: Read / Write / Construct Only