Muller
sample Muller's potential
Defines | Enumerations | Functions | Variables
muller.c File Reference

Muller's Potential sampling program. More...

#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <string.h>
#include <jwsc/base/error.h>
#include <jwsc/base/option.h>
#include <jwsc/math/constants.h>
#include <jwsc/stat/dynamics.h>
#include "sampler.h"

Go to the source code of this file.

Defines

#define NUM_OPTS_NO_ARG   2
#define NUM_OPTS_WITH_ARG   15
#define DEFAULT_SEED   289375
#define DEFAULT_ITERATIONS   1000
#define DEFAULT_HYBRID_LEAP_ITER   100
#define DEFAULT_START_X   0
#define DEFAULT_START_Y   0
#define DEFAULT_X_SIGMA   0.1
#define DEFAULT_X_MIN   -3.0
#define DEFAULT_X_MAX   1.5
#define DEFAULT_Y_SIGMA   0.1
#define DEFAULT_Y_MIN   -1.0
#define DEFAULT_Y_MAX   3.0
#define DEFAULT_DELTA_T   0.01
#define DEFAULT_ALPHA   0.9
#define DEFAULT_KICK   0
#define DEFAULT_HYPER_GAMMA   1.0e-5
#define DEFAULT_HYPER_ETA   1.0e-2
#define DEFAULT_HYPER_BIAS   150.0
#define DEFAULT_HYPER_SCALE   0.25
#define DEFAULT_SAMPLER   MH

Enumerations

enum  Sampler_type {
  MH, LANGE, HYPER, STOCH,
  HYBRID
}
 Types of samplers supported. More...

Functions

static void print_usage (void)
 Prints the usage of the program.
static Errorprocess_help_opt (void)
 Processes the 'help' program options.
static Errorprocess_version_opt (void)
 Processes the 'version' program options.
static Errorprocess_seed_opt (Option_arg arg)
 Processes the 'seed' program options.
static Errorprocess_iterations_opt (Option_arg arg)
 Processes the 'iterations' program options.
static Errorprocess_hybrid_leap_iter_opt (Option_arg arg)
 Processes the 'hybrid-leap-iter' program options.
static Errorprocess_start_x_opt (Option_arg arg)
 Processes the 'start-x' program options.
static Errorprocess_start_y_opt (Option_arg arg)
 Processes the 'start-y' program options.
static Errorprocess_delta_t_opt (Option_arg arg)
 Processes the 'delta-t' program options.
static Errorprocess_alpha_opt (Option_arg arg)
 Processes the 'alpha' program options.
static Errorprocess_kick_opt (Option_arg arg)
 Processes the 'kick' program options.
static Errorprocess_x_lim_opt (Option_arg arg)
 Processes the 'x-lim' program options.
static Errorprocess_x_sigma_opt (Option_arg arg)
 Processes the 'x-sigma' program options.
static Errorprocess_y_lim_opt (Option_arg arg)
 Processes the 'y-lim' program options.
static Errorprocess_y_sigma_opt (Option_arg arg)
 Processes the 'y-sigma' program options.
static Errorprocess_hyper_bias_opt (Option_arg arg)
 Processes the 'hyper-bias' program options.
static Errorprocess_hyper_scale_opt (Option_arg arg)
 Processes the 'hyper-scale' program options.
static Errorprocess_sampler_opt (Option_arg arg)
 Processes the 'sampler' program options.
int main (int argc, const char **argv)
 Main function for the surface program.

Variables

static Option_no_arg opts_no_arg [NUM_OPTS_NO_ARG]
 Program options taking no argument.
static Option_with_arg opts_with_arg [NUM_OPTS_WITH_ARG]
 Program options taking an argument.
static uint32_t seed = DEFAULT_SEED
 Random seed.
static uint32_t iterations = DEFAULT_ITERATIONS
 Number of sampling iterations.
static uint32_t hybrid_leap_iter = DEFAULT_HYBRID_LEAP_ITER
 Number of leapfrog iterations for hybrid Monte carlo sampling.
static double start_x = DEFAULT_START_X
 Starting x position.
static double start_y = DEFAULT_START_Y
 Starting y position.
static double x_sigma = DEFAULT_X_SIGMA
 Sigma for sampling over x.
static double x_min = DEFAULT_X_MIN
 Minimum value for over x.
static double x_max = DEFAULT_X_MAX
 Maximum value for over x.
static double y_sigma = DEFAULT_Y_SIGMA
 Sigma for sampling over y.
static double y_min = DEFAULT_Y_MIN
 Minimum value for over y.
static double y_max = DEFAULT_Y_MAX
 Maximum value for over y.
static double delta_t = DEFAULT_DELTA_T
 Stochastic dynamics integration step-size for Langevin Monte Carlo.
static double alpha = DEFAULT_ALPHA
 Stochastic dynamics integration step-size for Langevin Monte Carlo.
static uint32_t kick = DEFAULT_KICK
 Stochastic dynamics frequency to kick the particle by resetting the momenta.
static double hyper_bias = DEFAULT_HYPER_BIAS
 Bias strength parameter for hyperdynamics.
static double hyper_scale = DEFAULT_HYPER_SCALE
 Length scale parameter for hyperdynamics.
static double hyper_gamma = DEFAULT_HYPER_GAMMA
 Gamma parameter for gradient descent in hyperdynamics.
static double hyper_eta = DEFAULT_HYPER_ETA
 Eta parameter for derivative approximations in hyperdynamics.
static Sampler_type sampler = DEFAULT_SAMPLER
 Type of sampler to use.

Detailed Description

Muller's Potential sampling program.

Author:
Joseph Schlecht
License:
Creative Commons BY-NC-SA 3.0

Implements a collection of MCMC samplers over Muller's Potential.

Definition in file muller.c.


Define Documentation

#define NUM_OPTS_NO_ARG   2

Definition at line 102 of file muller.c.

#define NUM_OPTS_WITH_ARG   15

Definition at line 103 of file muller.c.

#define DEFAULT_SEED   289375

Definition at line 105 of file muller.c.

#define DEFAULT_ITERATIONS   1000

Definition at line 106 of file muller.c.

#define DEFAULT_HYBRID_LEAP_ITER   100

Definition at line 107 of file muller.c.

#define DEFAULT_START_X   0

Definition at line 108 of file muller.c.

#define DEFAULT_START_Y   0

Definition at line 109 of file muller.c.

#define DEFAULT_X_SIGMA   0.1

Definition at line 110 of file muller.c.

#define DEFAULT_X_MIN   -3.0

Definition at line 111 of file muller.c.

#define DEFAULT_X_MAX   1.5

Definition at line 112 of file muller.c.

#define DEFAULT_Y_SIGMA   0.1

Definition at line 113 of file muller.c.

#define DEFAULT_Y_MIN   -1.0

Definition at line 114 of file muller.c.

#define DEFAULT_Y_MAX   3.0

Definition at line 115 of file muller.c.

#define DEFAULT_DELTA_T   0.01

Definition at line 116 of file muller.c.

#define DEFAULT_ALPHA   0.9

Definition at line 117 of file muller.c.

#define DEFAULT_KICK   0

Definition at line 118 of file muller.c.

#define DEFAULT_HYPER_GAMMA   1.0e-5

Definition at line 119 of file muller.c.

#define DEFAULT_HYPER_ETA   1.0e-2

Definition at line 120 of file muller.c.

#define DEFAULT_HYPER_BIAS   150.0

Definition at line 121 of file muller.c.

#define DEFAULT_HYPER_SCALE   0.25

Definition at line 122 of file muller.c.

#define DEFAULT_SAMPLER   MH

Definition at line 123 of file muller.c.


Enumeration Type Documentation

Types of samplers supported.

Enumerator:
MH 
LANGE 
HYPER 
STOCH 
HYBRID 

Definition at line 129 of file muller.c.


Function Documentation

static void print_usage ( void  ) [static]

Prints the usage of the program.

Definition at line 209 of file muller.c.

static Error* process_help_opt ( void  ) [static]

Processes the 'help' program options.

Definition at line 218 of file muller.c.

static Error* process_version_opt ( void  ) [static]

Processes the 'version' program options.

Definition at line 225 of file muller.c.

static Error* process_seed_opt ( Option_arg  arg) [static]

Processes the 'seed' program options.

Definition at line 232 of file muller.c.

static Error* process_iterations_opt ( Option_arg  arg) [static]

Processes the 'iterations' program options.

Definition at line 246 of file muller.c.

static Error* process_hybrid_leap_iter_opt ( Option_arg  arg) [static]

Processes the 'hybrid-leap-iter' program options.

Definition at line 260 of file muller.c.

static Error* process_start_x_opt ( Option_arg  arg) [static]

Processes the 'start-x' program options.

Definition at line 274 of file muller.c.

static Error* process_start_y_opt ( Option_arg  arg) [static]

Processes the 'start-y' program options.

Definition at line 288 of file muller.c.

static Error* process_delta_t_opt ( Option_arg  arg) [static]

Processes the 'delta-t' program options.

Definition at line 302 of file muller.c.

static Error* process_alpha_opt ( Option_arg  arg) [static]

Processes the 'alpha' program options.

Definition at line 316 of file muller.c.

static Error* process_kick_opt ( Option_arg  arg) [static]

Processes the 'kick' program options.

Definition at line 330 of file muller.c.

static Error* process_x_lim_opt ( Option_arg  arg) [static]

Processes the 'x-lim' program options.

Definition at line 344 of file muller.c.

static Error* process_x_sigma_opt ( Option_arg  arg) [static]

Processes the 'x-sigma' program options.

Definition at line 362 of file muller.c.

static Error* process_y_lim_opt ( Option_arg  arg) [static]

Processes the 'y-lim' program options.

Definition at line 376 of file muller.c.

static Error* process_y_sigma_opt ( Option_arg  arg) [static]

Processes the 'y-sigma' program options.

Definition at line 394 of file muller.c.

static Error* process_hyper_bias_opt ( Option_arg  arg) [static]

Processes the 'hyper-bias' program options.

Definition at line 408 of file muller.c.

static Error* process_hyper_scale_opt ( Option_arg  arg) [static]

Processes the 'hyper-scale' program options.

Definition at line 422 of file muller.c.

static Error* process_sampler_opt ( Option_arg  arg) [static]

Processes the 'sampler' program options.

Definition at line 436 of file muller.c.

int main ( int  argc,
const char **  argv 
)

Main function for the surface program.

Definition at line 473 of file muller.c.


Variable Documentation

Option_no_arg opts_no_arg[NUM_OPTS_NO_ARG] [static]

Program options taking no argument.

Definition at line 141 of file muller.c.

Option_with_arg opts_with_arg[NUM_OPTS_WITH_ARG] [static]

Program options taking an argument.

Definition at line 144 of file muller.c.

uint32_t seed = DEFAULT_SEED [static]

Random seed.

Definition at line 147 of file muller.c.

uint32_t iterations = DEFAULT_ITERATIONS [static]

Number of sampling iterations.

Definition at line 150 of file muller.c.

uint32_t hybrid_leap_iter = DEFAULT_HYBRID_LEAP_ITER [static]

Number of leapfrog iterations for hybrid Monte carlo sampling.

Definition at line 153 of file muller.c.

double start_x = DEFAULT_START_X [static]

Starting x position.

Definition at line 156 of file muller.c.

double start_y = DEFAULT_START_Y [static]

Starting y position.

Definition at line 159 of file muller.c.

double x_sigma = DEFAULT_X_SIGMA [static]

Sigma for sampling over x.

Definition at line 162 of file muller.c.

double x_min = DEFAULT_X_MIN [static]

Minimum value for over x.

Definition at line 165 of file muller.c.

double x_max = DEFAULT_X_MAX [static]

Maximum value for over x.

Definition at line 168 of file muller.c.

double y_sigma = DEFAULT_Y_SIGMA [static]

Sigma for sampling over y.

Definition at line 171 of file muller.c.

double y_min = DEFAULT_Y_MIN [static]

Minimum value for over y.

Definition at line 174 of file muller.c.

double y_max = DEFAULT_Y_MAX [static]

Maximum value for over y.

Definition at line 177 of file muller.c.

double delta_t = DEFAULT_DELTA_T [static]

Stochastic dynamics integration step-size for Langevin Monte Carlo.

Definition at line 180 of file muller.c.

double alpha = DEFAULT_ALPHA [static]

Stochastic dynamics integration step-size for Langevin Monte Carlo.

Definition at line 183 of file muller.c.

uint32_t kick = DEFAULT_KICK [static]

Stochastic dynamics frequency to kick the particle by resetting the momenta.

Definition at line 189 of file muller.c.

double hyper_bias = DEFAULT_HYPER_BIAS [static]

Bias strength parameter for hyperdynamics.

Definition at line 192 of file muller.c.

double hyper_scale = DEFAULT_HYPER_SCALE [static]

Length scale parameter for hyperdynamics.

Definition at line 195 of file muller.c.

double hyper_gamma = DEFAULT_HYPER_GAMMA [static]

Gamma parameter for gradient descent in hyperdynamics.

Definition at line 198 of file muller.c.

double hyper_eta = DEFAULT_HYPER_ETA [static]

Eta parameter for derivative approximations in hyperdynamics.

Definition at line 201 of file muller.c.

Sampler_type sampler = DEFAULT_SAMPLER [static]

Type of sampler to use.

Definition at line 204 of file muller.c.