Muller
sample Muller's potential
|
00001 /* 00002 * This work is licensed under a Creative Commons 00003 * Attribution-Noncommercial-Share Alike 3.0 United States License. 00004 * 00005 * http://creativecommons.org/licenses/by-nc-sa/3.0/us/ 00006 * 00007 * You are free: 00008 * 00009 * to Share - to copy, distribute, display, and perform the work 00010 * to Remix - to make derivative works 00011 * 00012 * Under the following conditions: 00013 * 00014 * Attribution. You must attribute the work in the manner specified by the 00015 * author or licensor (but not in any way that suggests that they endorse you 00016 * or your use of the work). 00017 * 00018 * Noncommercial. You may not use this work for commercial purposes. 00019 * 00020 * Share Alike. If you alter, transform, or build upon this work, you may 00021 * distribute the resulting work only under the same or similar license to 00022 * this one. 00023 * 00024 * For any reuse or distribution, you must make clear to others the license 00025 * terms of this work. The best way to do this is by including this header. 00026 * 00027 * Any of the above conditions can be waived if you get permission from the 00028 * copyright holder. 00029 * 00030 * Apart from the remix rights granted under this license, nothing in this 00031 * license impairs or restricts the author's moral rights. 00032 */ 00033 00034 00047 #ifndef SAMPLER_H 00048 #define SAMPLER_H 00049 00050 00051 #include <config.h> 00052 00053 #include <stdlib.h> 00054 #include <stdio.h> 00055 #include <inttypes.h> 00056 #include <math.h> 00057 00058 #include <jwsc/base/error.h> 00059 #include <jwsc/base/limits.h> 00060 #include <jwsc/vector/vector.h> 00061 #include <jwsc/prob/pdf.h> 00062 00063 #include "potential.h" 00064 #include "sampler.h" 00065 00066 00067 #ifdef __cplusplus 00068 namespace jwsc { 00069 extern "C" { 00070 #endif 00071 00072 00077 Error* metropolis_hastings 00078 ( 00079 uint32_t iterations, 00080 double start_x, 00081 double start_y, 00082 double x_sigma, 00083 double x_min, 00084 double x_max, 00085 double y_sigma, 00086 double y_min, 00087 double y_max 00088 ); 00089 00090 00091 typedef struct 00092 { 00093 double x; 00094 double y; 00095 } 00096 Params; 00097 00098 00099 void get_pt_from_params(Vector_d** p_out, const void* params); 00100 Error* set_params_from_pt(const Vector_d* p, void* params); 00101 Error* energy_func(double* energy_out, void* params); 00102 Error* grad_energy_func(Vector_d** grad_out, void* params); 00103 Error* langevin_accept_sample(const Vector_d* sample, void* params); 00104 Error* hyper_accept_sample(const Vector_d* sample, void* params, double Vb); 00105 Error* stochastic_dynamics_accept_sample(const Vector_d* sample, const Vector_d* momenta, void* params); 00106 Error* hybrid_mc_accept_sample(const Vector_d* sample, const Vector_d* momenta, void* params); 00107 00108 00109 #ifdef __cplusplus 00110 } 00111 } 00112 #endif 00113 00114 00115 #endif