Debian Codegraph @

contrib/ms-sbvar/switch_dw/switching/dw_equi_energy_simulation.h

raw
1 /*
2 * Copyright (C) 1996-2011 Daniel Waggoner and Tao Zha
3 *
4 * This free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * It is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * If you did not received a copy of the GNU General Public License
15 * with this software, see <http://www.gnu.org/licenses/>.
16 */
17
18 #ifndef __equi_energy__
19 #define __equi_energy__
20
21 #define _EEFLAG_USEMODEL_ 1
22 #define _EEFLAG_USENEW_ 2
23 #define _EEFLAG_USEOLD_ 4
24
25 #include "dw_matrix.h"
26
27 typedef struct TEquiEnergy_tag
28 {
29 int nlevels;
30 TVector loglevels;
31 TVector temperatures;
32 PRECISION p; // probability that we draw from previous level
33 int n; // number of doubles in data
34 int n_theta; // number of parameters in theta. n = n_theta + n_q + 1
35
36 int level;
37 int ring;
38 PRECISION logposteriorkernel;
39 PRECISION *draw;
40
41 PRECISION new_logposteriorkernel;
42 PRECISION *new_draw;
43 } TEquiEnergy;
44
45 void FreeTEquiEnergy(TEquiEnergy *equi);
46 TEquiEnergy* CreateTEquiEnergy(TVector loglevels, TVector temperature, PRECISION p, int n, int n_theta, int level);
47
48 int GetDraw(TEquiEnergy *equi);
49 int PutDraw(TEquiEnergy *equi, TStateModel *model, int flag);
50
51 int GetRingIndex(TVector loglevels, PRECISION logposteriorkernel, int idx);
52 int draw_equi_energy(TEquiEnergy *equi, TStateModel *model);
53
54 int EquiEnergySimulationRun(int count, TStateMdoel *model, TVector loglevels, TVector temperatures, PRECISION p, int level);
55 int dw_equi_energy_command_line(int nargs, char **args, TStateModel);
56
57 #endif
58
59 /********************************************************************************
60 GetDraw_equi_energy(TStateModel *model, TEquiEnergy *equi, int level)
61
62
63 When entering a new level
64 1) Initialize generator, which could include adaptive burn-in period. The more
65 usual burn-in could be ommitted for all levels but the first. The results
66 of this initialization should be available to all instances of this level
67 2)
68
69
70
71 ********************************************************************************/