SWZ: remove instances of swz throughout

time-shift
Houtan Bastani 2011-02-18 12:00:35 +01:00
parent 0db26e98a1
commit dd6159d791
11 changed files with 53 additions and 53 deletions

View File

@ -1,6 +1,6 @@
function clean_swz_files(mod_name)
% function clean_swz_files()
% removes SWZ intermediary files
function clean_ms_files(mod_name)
% function clean_ms_files()
% removes MS intermediary files
%
% INPUTS
% none
@ -11,7 +11,7 @@ function clean_swz_files(mod_name)
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2007-2008, 2010 Dynare Team
% Copyright (C) 2007-2011 Dynare Team
%
% This file is part of Dynare.
%

View File

@ -1,4 +1,4 @@
function swz_mardd(options_)
function ms_mardd(options_)
% Applies to both linear and exclusion restrictions.
% (1) Marginal likelihood function p(Y) for constant structural VAR models, using Chib (1995)'s ``Marginal Likelihood from the Gibbs Output'' in JASA.
% (2) Conditional likelihood function f(Y|A0, A+) on the ML estimate for constant exclusion-identified models.

View File

@ -1,14 +1,14 @@
function swz_sbvar(ms_flag, M, options)
function ms_sbvar(ms_flag, M, options)
dynareroot = strrep(which('dynare'),'dynare.m','');
swz_root = [dynareroot '/ms-sbvar'];
ms_root = [dynareroot '/ms-sbvar'];
addpath([swz_root '/cstz']);
addpath([swz_root '/identification']);
addpath([swz_root '/switching_specification']);
addpath([swz_root '/mhm_specification']);
addpath([ms_root '/cstz']);
addpath([ms_root '/identification']);
addpath([ms_root '/switching_specification']);
addpath([ms_root '/mhm_specification']);
clean_swz_files(M.fname);
clean_ms_files(M.fname);
options.data = read_variables(options.datafile,options.varobs,[],options.xls_sheet,options.xls_range);
@ -35,7 +35,7 @@ elseif ~isempty(options.ms.Qi) && ~isempty(options.ms.Ri)
end
if ms_flag == 1
% changing some option names to match SWZ code
% changing some option names to match MS code
options.ms.firstMetrop = options.ms.draws_nbr_burn_in_1;
options.ms.secondMetrop = options.ms.draws_nbr_burn_in_2;
options.ms.ndrawsmv = options.ms.draws_nbr_mean_var_estimate;
@ -50,5 +50,5 @@ if ms_flag == 1
options.ms.markov_file = 'markov_file';
sz_prd(M,options);
else
swz_mardd(options);
ms_mardd(options);
end

View File

@ -1,4 +1,4 @@
function swz_write_markov_file(fname,M,options)
function ms_write_markov_file(fname,M,options)
n_chains = length(options.ms.ms_chain);
nvars = size(options.varobs,1);

View File

@ -1,4 +1,4 @@
function swz_write_mhm_input(fname,options_ms)
function ms_write_mhm_input(fname,options_ms)
fh = fopen(fname,'w');

View File

@ -6,17 +6,17 @@ function sz_prd(M,options_)
%generation of mhm file
%generateMHM_input(options_);
swz_root = strrep(which('swz_sbvar'),'/swz_sbvar.m','');
ms_root = strrep(which('ms_sbvar'),'/ms_sbvar.m','');
% path for C executables
%c_path='./c-executables';
c_path = [swz_root '/bin'];
c_path = [ms_root '/bin'];
% path for Markov specification
m_spec_path=[swz_root '/switching_specification'];
m_spec_path=[ms_root '/switching_specification'];
% path for MHM specification
mhm_spec_path=[swz_root '/mhm_specification'];
mhm_spec_path=[ms_root '/mhm_specification'];
%==========================================================================
%== Processing control
@ -486,7 +486,7 @@ if options_.ms.create_initialization_file == 1
%======================================================================
%== Create C initialization filename
%======================================================================
swz_write_markov_file(markov_file,M,options_)
ms_write_markov_file(markov_file,M,options_)
if options_.ms.standalone == 1
if use_linux == 1
create_init_file=[c_path,'/sbvar_init_file ',matlab_filename,' ',markov_file,' ',options_.ms.output_file_tag];
@ -527,7 +527,7 @@ end
%==========================================================================
if options_.ms.compute_mdd == 1
mhm_file = ['mhm_input_' M.fname '.dat'];
swz_write_mhm_input(mhm_file,options_.ms);
ms_write_mhm_input(mhm_file,options_.ms);
if options_.ms.standalone == 1
if use_linux == 1
compute_mdd1=[c_path,'/sbvar_mhm_1 -cseed 5 -ft ',options_.ms.output_file_tag,' -fi ',mhm_file];
@ -588,4 +588,4 @@ if options_.ms.print_draws == 1 %error here as well
[err] = mex_sbvar_draws(print_draws);
mexErrCheck('mex_sbvar_draws',err);
end
end
end

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010 Dynare Team
* Copyright (C) 2010-2011 Dynare Team
*
* This file is part of Dynare.
*
@ -44,38 +44,38 @@ mexFunction(int nlhs, mxArray *plhs[],
* Check args
*/
if (nrhs != 1 || !mxIsChar(prhs[0]) || nlhs != 1)
DYN_MEX_FUNC_ERR_MSG_TXT("Error in swz_mex: this function takes 1 string input argument and returns 1 output argument.");
DYN_MEX_FUNC_ERR_MSG_TXT("Error in MS-SBVAR MEX file: this function takes 1 string input argument and returns 1 output argument.");
/*
* Allocate memory
*/
maxnargs = (int)(mxGetN(prhs[0])/2+1);
argument = (char *)swzCalloc(mxGetN(prhs[0])+1, sizeof(char));
args = (char **)swzCalloc(maxnargs, sizeof(char *));
argument = (char *)mxCalloc(mxGetN(prhs[0])+1, sizeof(char));
args = (char **)mxCalloc(maxnargs, sizeof(char *));
if (argument==NULL || args==NULL)
DYN_MEX_FUNC_ERR_MSG_TXT("Error in swz_mex: could not allocate memory. (1)");
DYN_MEX_FUNC_ERR_MSG_TXT("Error in MS-SBVAR MEX file: could not allocate memory. (1)");
/*
* Create argument string from prhs and parse to create args / nargs
*/
if (!(args[nargs] = (char *)swzCalloc(strlen(mainarg)+1, sizeof(char))))
DYN_MEX_FUNC_ERR_MSG_TXT("Error in swz_mex: could not allocate memory. (2)");
if (!(args[nargs] = (char *)mxCalloc(strlen(mainarg)+1, sizeof(char))))
DYN_MEX_FUNC_ERR_MSG_TXT("Error in MS-SBVAR MEX file: could not allocate memory. (2)");
strncpy(args[nargs++], mainarg, strlen(mainarg));
if (mxGetString(prhs[0], argument, mxGetN(prhs[0])+1))
DYN_MEX_FUNC_ERR_MSG_TXT("Error in swz_mex: error using mxGetString.\n");
DYN_MEX_FUNC_ERR_MSG_TXT("Error in MS-SBVAR MEX file: error using mxGetString.\n");
beginarg = &argument[0];
while((n=strcspn(beginarg, " ")))
{
if (!(args[nargs] = (char *)swzCalloc(n+1, sizeof(char))))
DYN_MEX_FUNC_ERR_MSG_TXT("Error in swz_mex: could not allocate memory. (3)");
if (!(args[nargs] = (char *)mxCalloc(n+1, sizeof(char))))
DYN_MEX_FUNC_ERR_MSG_TXT("Error in MS-SBVAR MEX file: could not allocate memory. (3)");
strncpy(args[nargs++], beginarg, n);
beginarg += (isspace(beginarg[n]) || isblank(beginarg[n]) ? ++n : n);
}
swzFree(argument);
mxFree(argument);
/*
* Call top_level function (formerly main)
@ -93,8 +93,8 @@ mexFunction(int nlhs, mxArray *plhs[],
* free memory
*/
for (n=0; n<nargs; n++)
swzFree(args[n]);
swzFree(args);
mxFree(args[n]);
mxFree(args);
plhs[0] = mxCreateDoubleScalar(0);
}

View File

@ -36,7 +36,7 @@ extern "C"
int constant_seed;
void
swz_fprintf_err(char *str, ...)
ms_fprintf_err(char *str, ...)
{
va_list ap;
va_start(ap, str);
@ -53,10 +53,10 @@ extern "C"
void
swzExit(int status)
msExit(int status)
{
#if defined(MATLAB_MEX_FILE) || defined(OCTAVE_MEX_FILE)
throw "Error in SWZ mex file.\n";
throw "Error in MS-SBVAR MEX file.\n";
#else
exit(status);
#endif

View File

@ -20,8 +20,8 @@
#ifndef _MEXMOD
#define _MEXMOD
void swz_exit(int status);
void swz_fprintf_err(const char * str, ...);
void ms_exit(int status);
void ms_fprintf_err(const char * str, ...);
extern int constant_seed;
#endif
@ -34,10 +34,10 @@ extern int constant_seed;
#include <dynlapack.h>
#include <mat.h>
#define swzMalloc mxMalloc
#define swzCalloc mxCalloc
#define swzRealloc mxRealloc
#define swzFree mxFree
#define msMalloc mxMalloc
#define msCalloc mxCalloc
#define msRealloc mxRealloc
#define msFree mxFree
mxArray *globalMatlabStruct;
@ -52,10 +52,10 @@ mxArray *getMxArray(double *, int, int);
#else
#define swz_fprintf_stdout printf
#define swzMalloc malloc
#define swzCalloc calloc
#define swzRealloc realloc
#define swzFree free
#define ms_fprintf_stdout printf
#define msMalloc malloc
#define msCalloc calloc
#define msRealloc realloc
#define msFree free
#endif

View File

@ -852,7 +852,7 @@ void
SBVARStatement::writeOutput(ostream &output, const string &basename) const
{
options_list.writeOutput(output);
output << "swz_sbvar(0,M_,options_);" << endl;
output << "ms_sbvar(0,M_,options_);" << endl;
}
MS_SBVARStatement::MS_SBVARStatement(const OptionsList &options_list_arg) :
@ -870,7 +870,7 @@ void
MS_SBVARStatement::writeOutput(ostream &output, const string &basename) const
{
options_list.writeOutput(output);
output << "swz_sbvar(1,M_,options_);" << endl;
output << "ms_sbvar(1,M_,options_);" << endl;
}
IdentificationStatement::IdentificationStatement(const OptionsList &options_list_arg) :

2
tests/.gitignore vendored
View File

@ -40,6 +40,7 @@
!/ls2003/data_ca1.m
!/objectives/sgu_ex1.mat
!/missing/simulate_data_with_missing_observations.m
!/ms-sbvar/data.m
!/parallel/data_ca1.m
!/pi2004/idata.m
!/pi2004/ych.dat
@ -51,6 +52,5 @@
!/recursive/data_ca1.m
!/run_test.m
!/run_test_octave.m
!/swz/data.m
!/test.m
!/fs2000_ssfile_aux.m