JWS C Library
C language utility library
|
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 DYNAMICS_H 00048 #define DYNAMICS_H 00049 00050 00051 #include <jwsc/config.h> 00052 00053 #include <stdlib.h> 00054 #include <inttypes.h> 00055 00056 #include "jwsc/base/error.h" 00057 #include "jwsc/vector/vector.h" 00058 #include "jwsc/matrix/matrix.h" 00059 00060 00061 #ifdef __cplusplus 00062 namespace jwsc { 00063 extern "C" { 00064 #endif 00065 00066 00076 Error* stochastic_dynamics_1_d 00077 ( 00078 uint32_t iterations, 00079 double delta_t, 00080 double alpha, 00081 uint32_t kick, 00082 void* params, 00083 void (*get_pt_from_params)(Vector_d** p_out, const void* params), 00084 Error* (*grad_energy_func)(Vector_d** grad_out, void* params), 00085 Error* (*accept_sample)(const Vector_d* sample, const Vector_d* momenta, void* params) 00086 ); 00087 00088 00090 Error* stochastic_dynamics_2_d 00091 ( 00092 uint32_t iterations, 00093 const Vector_d* delta_t, 00094 double alpha, 00095 uint32_t kick, 00096 void* params, 00097 void (*get_pt_from_params)(Vector_d** p_out, const void* params), 00098 Error* (*grad_energy_func)(Vector_d** grad_out, void* params), 00099 Error* (*accept_sample)(const Vector_d* sample, const Vector_d* momenta, void* params) 00100 ); 00101 00116 Error* hybrid_monte_carlo_1_d 00117 ( 00118 uint32_t iterations, 00119 uint32_t leap_itera, 00120 double delta_t, 00121 double alpha, 00122 uint32_t kick, 00123 void* params, 00124 void (*get_pt_from_params)(Vector_d** p_out, const void* params), 00125 Error* (*set_params_from_pt)(const Vector_d* p, void* params), 00126 Error* (*energy_func)(double* energy_out, void* params), 00127 Error* (*grad_energy_func)(Vector_d** grad_out, void* params), 00128 Error* (*accept_sample)(const Vector_d* sample, const Vector_d* momenta, void* params), 00129 Error* (*reject_sample)(const Vector_d* sample, const Vector_d* momenta, void* params) 00130 ); 00131 00133 Error* hybrid_monte_carlo_2_d 00134 ( 00135 uint32_t iterations, 00136 uint32_t leap_itera, 00137 const Vector_d* delta_t, 00138 double alpha, 00139 uint32_t kick, 00140 void* params, 00141 void (*get_pt_from_params)(Vector_d** p_out, const void* params), 00142 Error* (*set_params_from_pt)(const Vector_d* p, void* params), 00143 Error* (*energy_func)(double* energy_out, void* params), 00144 Error* (*grad_energy_func)(Vector_d** grad_out, void* params), 00145 Error* (*accept_sample)(const Vector_d* sample, const Vector_d* momenta, void* params), 00146 Error* (*reject_sample)(const Vector_d* sample, const Vector_d* momenta, void* params) 00147 ); 00148 00162 Error* langevin_1_f 00163 ( 00164 uint32_t iterations, 00165 float delta_t, 00166 void* params, 00167 void (*get_pt_from_params)(Vector_f** p_out, const void* params), 00168 Error* (*grad_energy_func)(Vector_f** grad_out, void* params), 00169 Error* (*accept_sample)(const Vector_f* sample, void* params) 00170 ); 00171 00173 Error* langevin_2_f 00174 ( 00175 uint32_t iterations, 00176 const Vector_f* delta_t, 00177 void* params, 00178 void (*get_pt_from_params)(Vector_f** p_out, const void* params), 00179 Error* (*grad_energy_func)(Vector_f** grad_out, void* params), 00180 Error* (*accept_sample)(const Vector_f* sample, void* params) 00181 ); 00182 00184 Error* langevin_1_d 00185 ( 00186 uint32_t iterations, 00187 double delta_t, 00188 void* params, 00189 void (*get_pt_from_params)(Vector_d** p_out, const void* params), 00190 Error* (*grad_energy_func)(Vector_d** grad_out, void* params), 00191 Error* (*accept_sample)(const Vector_d* sample, void* params) 00192 ); 00193 00195 Error* langevin_2_d 00196 ( 00197 uint32_t iterations, 00198 const Vector_d* delta_t, 00199 void* params, 00200 void (*get_pt_from_params)(Vector_d** p_out, const void* params), 00201 Error* (*grad_energy_func)(Vector_d** grad_out, void* params), 00202 Error* (*accept_sample)(const Vector_d* sample, void* params) 00203 ); 00204 00219 Error* langevin_hyperdynamics_1_f 00220 ( 00221 uint32_t iterations, 00222 float delta_t, 00223 float gamma, 00224 float eta, 00225 float h, 00226 float d, 00227 void* params, 00228 void (*get_pt_from_params)(Vector_f** p_out, const void* params), 00229 Error* (*set_params_from_pt)(const Vector_f* p, void* params), 00230 Error* (*energy_func)(float* energy_out, void* params), 00231 Error* (*grad_energy_func)(Vector_f** grad_out, void* params), 00232 Error* (*accept_sample)(const Vector_f* sample, void* params, float energy_bias) 00233 ); 00234 00236 Error* langevin_hyperdynamics_2_f 00237 ( 00238 uint32_t iterations, 00239 const Vector_f* init_delta_t, 00240 float gamma, 00241 float eta, 00242 float h, 00243 float d, 00244 void* params, 00245 void (*get_pt_from_params)(Vector_f** p_out, const void* params), 00246 Error* (*set_params_from_pt)(const Vector_f* p, void* params), 00247 Error* (*energy_func)(float* energy_out, void* params), 00248 Error* (*grad_energy_func)(Vector_f** grad_out, void* params), 00249 Error* (*accept_sample)(const Vector_f* sample, void* params, float energy_bias) 00250 ); 00251 00253 Error* langevin_hyperdynamics_1_d 00254 ( 00255 uint32_t iterations, 00256 double delta_t, 00257 double gamma, 00258 double eta, 00259 double h, 00260 double d, 00261 void* params, 00262 void (*get_pt_from_params)(Vector_d** p_out, const void* params), 00263 Error* (*set_params_from_pt)(const Vector_d* p, void* params), 00264 Error* (*energy_func)(double* energy_out, void* params), 00265 Error* (*grad_energy_func)(Vector_d** grad_out, void* params), 00266 Error* (*accept_sample)(const Vector_d* sample, void* params, double energy_bias) 00267 ); 00268 00270 Error* langevin_hyperdynamics_2_d 00271 ( 00272 uint32_t iterations, 00273 const Vector_d* init_delta_t, 00274 double gamma, 00275 double eta, 00276 double h, 00277 double d, 00278 void* params, 00279 void (*get_pt_from_params)(Vector_d** p_out, const void* params), 00280 Error* (*set_params_from_pt)(const Vector_d* p, void* params), 00281 Error* (*energy_func)(double* energy_out, void* params), 00282 Error* (*grad_energy_func)(Vector_d** grad_out, void* params), 00283 Error* (*accept_sample)(const Vector_d* sample, void* params, double energy_bias) 00284 ); 00285 00289 #ifdef __cplusplus 00290 } 00291 } 00292 #endif 00293 00294 00295 #endif