Debian Codegraph @

contrib/ms-sbvar/switch_dw/state_space/sbvar/VARio.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 __VAR_INPUT_OUTPUT__
19 #define __VAR_INPUT_OUTPUT__
20
21 #include "switch.h"
22 #include "VARbase.h"
23
24 void Write_VAR_Specification(FILE *f, char *filename, TStateModel *model);
25 TStateModel* Read_VAR_Specification(FILE *f, char *filename);
26
27 int Read_VAR_Parameters(FILE *f, char *filename, char *id, TStateModel *model);
28 int Read_VAR_ParametersFlat(FILE *f_in, TStateModel *model);
29 int Write_VAR_Parameters(FILE *f, char *filename, char *id, TStateModel *model);
30 int Write_VAR_ParametersFlat(FILE *f, TStateModel *model, char *fmt);
31 int Write_VAR_ParametersFlat_Headers(FILE *f_out, TStateModel *model);
32 int Write_VAR_ParametersFlat_A0_Diagonal_One(FILE *f, TStateModel *model, char *fmt);
33
34 #if defined(MATLAB_MEX_FILE) || defined(OCTAVE_MEX_FILE)
35 int Write_VAR_Parameters_Mat(TStateModel *model, char *filename);
36 #endif
37
38 void ReadAllParameters(FILE *f, char *filename, char *id, TStateModel *model);
39 void WriteAllParameters(FILE *f, char *filename, char *id, TStateModel *model);
40
41 int Read_VAR_Parameters_Original(FILE *f, char *filename, char *header, TStateModel *model);
42
43 /* Flag values */
44 #define F_FLAT 0x0001
45 #define F_FREE 0x0002
46
47 int GetPosteriorDraw(FILE *posterior_file, TStateModel *model, int flag);
48
49 /**************** Reading init/est_intermediate/est_final files ****************/
50 typedef struct
51 {
52 char *in_directory; // -di (default "")
53 char *in_tag; // -ft (default NULL)
54 char *specification_filename; // -fs (default NULL)
55 char *parameters_filename; // -fp (default NULL)
56 char *parameters_header; // -ph (default NULL)
57
58 char *specification_filename_actual;
59 char *parameters_filename_actual;
60 char *parameters_header_actual;
61
62 char *out_directory; // -do (default "")
63 char *out_filename; // -fo (default NULL)
64 char *out_tag; // -fto (default NULL)
65 char *out_header; // -pho (default NULL)
66
67 int MLE; // 1 if -MLE and 0 otherwise
68
69 TStateModel *model;
70 } TVARCommandLine;
71
72 char* CreateFilenameFromTag(char *fmt, char *tag, char *dir);
73 char* CreatePath(char *path);
74
75 TVARCommandLine* Create_VARCommandLine(void);
76 void Free_VARCommandLine(TVARCommandLine *cmd);
77 TVARCommandLine* Base_VARCommandLine(int nargs, char **args);
78 void OutTag_VARCommandLine(TVARCommandLine *cmd);
79
80 TVARCommandLine* CreateTStateModel_VARCommandLine(int nargs, char **args, TVARCommandLine *cmd);
81 /*******************************************************************************/
82
83 #endif