Merge branch 'master' into remove-dynDate-class

Conflicts:
	preprocessor/DynareBison.yy
issue#70
Stéphane Adjemian (Penelope) 2013-11-14 16:41:08 +01:00
commit 966ed438c1
7 changed files with 33 additions and 11 deletions

View File

@ -581,15 +581,20 @@ EstimatedParamsStatement::writeOutput(ostream &output, const string &basename) c
}
EstimatedParamsInitStatement::EstimatedParamsInitStatement(const vector<EstimationParams> &estim_params_list_arg,
const SymbolTable &symbol_table_arg) :
const SymbolTable &symbol_table_arg,
const bool use_calibration_arg) :
estim_params_list(estim_params_list_arg),
symbol_table(symbol_table_arg)
symbol_table(symbol_table_arg),
use_calibration(use_calibration_arg)
{
}
void
EstimatedParamsInitStatement::writeOutput(ostream &output, const string &basename) const
{
if (use_calibration)
output << "options_.use_calibration_initialization = 1;" << endl;
vector<EstimationParams>::const_iterator it;
for (it = estim_params_list.begin(); it != estim_params_list.end(); it++)

View File

@ -290,9 +290,11 @@ class EstimatedParamsInitStatement : public Statement
private:
const vector<EstimationParams> estim_params_list;
const SymbolTable &symbol_table;
const bool use_calibration;
public:
EstimatedParamsInitStatement(const vector<EstimationParams> &estim_params_list_arg,
const SymbolTable &symbol_table_arg);
const SymbolTable &symbol_table_arg,
const bool use_calibration_arg);
virtual void writeOutput(ostream &output, const string &basename) const;
};

View File

@ -90,7 +90,7 @@ class ParsingDriver;
%}
%token AIM_SOLVER ANALYTIC_DERIVATION AR AUTOCORR
%token BAYESIAN_IRF BETA_PDF BLOCK
%token BAYESIAN_IRF BETA_PDF BLOCK USE_CALIBRATION
%token BVAR_DENSITY BVAR_FORECAST
%token BVAR_PRIOR_DECAY BVAR_PRIOR_FLAT BVAR_PRIOR_LAMBDA
%token BVAR_PRIOR_MU BVAR_PRIOR_OMEGA BVAR_PRIOR_TAU BVAR_PRIOR_TRAIN
@ -106,7 +106,7 @@ class ParsingDriver;
%token HISTVAL HOMOTOPY_SETUP HOMOTOPY_MODE HOMOTOPY_STEPS HOMOTOPY_FORCE_CONTINUE HP_FILTER HP_NGRID HYBRID
%token IDENTIFICATION INF_CONSTANT INITVAL INITVAL_FILE BOUNDS JSCALE INIT
%token <string_val> INT_NUMBER
%token INV_GAMMA_PDF INV_GAMMA1_PDF INV_GAMMA2_PDF IRF IRF_SHOCKS
%token INV_GAMMA_PDF INV_GAMMA1_PDF INV_GAMMA2_PDF IRF IRF_SHOCKS IRF_PLOT_THRESHOLD
%token KALMAN_ALGO KALMAN_TOL SUBSAMPLES OPTIONS TOLF
%token LAPLACE LIK_ALGO LIK_INIT LINEAR LOAD_IDENT_FILES LOAD_MH_FILE LOAD_PARAMS_AND_STEADY_STATE LOGLINEAR LYAPUNOV
%token LYAPUNOV_FIXED_POINT_TOL LYAPUNOV_DOUBLING_TOL LYAPUNOV_SQUARE_ROOT_SOLVER_TOL LOG_DEFLATOR LOG_TREND_VAR LOG_GROWTH_FACTOR MARKOWITZ MARGINAL_DENSITY MAX MAXIT
@ -990,6 +990,7 @@ stoch_simul_primary_options : o_dr_algo
| o_dr_cycle_reduction_tol
| o_dr_logarithmic_reduction_tol
| o_dr_logarithmic_reduction_maxiter
| o_irf_plot_threshold
;
stoch_simul_options : stoch_simul_primary_options
@ -1136,7 +1137,10 @@ estimated_elem3 : expression_or_empty COMMA expression_or_empty
;
estimated_params_init : ESTIMATED_PARAMS_INIT ';' estimated_init_list END ';'
{ driver.estimated_params_init(); };
{ driver.estimated_params_init(); }
| ESTIMATED_PARAMS_INIT '(' USE_CALIBRATION ')' ';' estimated_init_list END ';'
{ driver.estimated_params_init(true); }
;
estimated_init_list : estimated_init_list estimated_init_elem
{ driver.add_estimated_params_element(); }
@ -1562,6 +1566,7 @@ estimation_options : o_datafile
| o_taper_steps
| o_geweke_interval
| o_mcmc_jumping_covariance
| o_irf_plot_threshold
;
list_optim_option : QUOTED_STRING COMMA QUOTED_STRING
@ -2689,6 +2694,7 @@ o_mcmc_jumping_covariance : MCMC_JUMPING_COVARIANCE EQUAL HESSIAN
| MCMC_JUMPING_COVARIANCE EQUAL filename
{ driver.option_str("MCMC_jumping_covariance", $3); }
;
o_irf_plot_threshold : IRF_PLOT_THRESHOLD EQUAL non_negative_number { driver.option_num("impulse_responses.plot_threshold", $3); };
range : symbol ':' symbol
{

View File

@ -397,7 +397,7 @@ string eofbuff;
return token::CNUM;
}
<DYNARE_STATEMENT>banact {return token::BANACT;}
<DYNARE_BLOCK>use_calibration {return token::USE_CALIBRATION;}
<DYNARE_STATEMENT>output_file_tag {return token::OUTPUT_FILE_TAG;}
<DYNARE_STATEMENT>file_tag {return token::FILE_TAG;};
<DYNARE_STATEMENT>no_create_init {return token::NO_CREATE_INIT;};
@ -569,6 +569,7 @@ string eofbuff;
<DYNARE_STATEMENT>mh_recover {return token::MH_RECOVER;}
<DYNARE_STATEMENT>planner_discount {return token::PLANNER_DISCOUNT;}
<DYNARE_STATEMENT>calibration {return token::CALIBRATION;}
<DYNARE_STATEMENT>irf_plot_threshold {return token::IRF_PLOT_THRESHOLD;}
<DYNARE_BLOCK>equation {return token::EQUATION;}
<DYNARE_BLOCK>exclusion {return token::EXCLUSION;}

View File

@ -703,7 +703,15 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, b
if (block && !byte_code)
mOutputFile << "rmpath " << basename << ";" << endl;
mOutputFile << "save('" << basename << "_results.mat', 'oo_', 'M_', 'options_');" << endl;
mOutputFile << "save('" << basename << "_results.mat', 'oo_', 'M_', 'options_');" << endl
<< "if exist('estim_params_', 'var') == 1" << endl
<< " save('" << basename << "_results.mat', 'estim_params_', '-append');" << endl << "end" << endl
<< "if exist('bayestopt_', 'var') == 1" << endl
<< " save('" << basename << "_results.mat', 'bayestopt_', '-append');" << endl << "end" << endl
<< "if exist('dataset_', 'var') == 1" << endl
<< " save('" << basename << "_results.mat', 'dataset_', '-append');" << endl << "end" << endl
<< "if exist('estimation_info', 'var') == 1" << endl
<< " save('" << basename << "_results.mat', 'estimation_info', '-append');" << endl << "end" << endl;
config_file.writeEndParallel(mOutputFile);

View File

@ -1209,9 +1209,9 @@ ParsingDriver::estimated_params()
}
void
ParsingDriver::estimated_params_init()
ParsingDriver::estimated_params_init(bool use_calibration)
{
mod_file->addStatement(new EstimatedParamsInitStatement(estim_params_list, mod_file->symbol_table));
mod_file->addStatement(new EstimatedParamsInitStatement(estim_params_list, mod_file->symbol_table, use_calibration));
estim_params_list.clear();
}

View File

@ -394,7 +394,7 @@ public:
//! Writes estimated params command
void estimated_params();
//! Writes estimated params init command
void estimated_params_init();
void estimated_params_init(bool use_calibration = false);
//! Writes estimated params bound command
void estimated_params_bounds();
//! Adds a declaration for a user-defined external function