Merge pull request #510 from FerhatMihoubi/master

Various fixes by Ferhat
time-shift
Sébastien Villemot 2013-10-28 23:25:05 -07:00
commit 4e7806d71c
6 changed files with 26 additions and 11 deletions

View File

@ -363,7 +363,7 @@ Get_Arguments_and_global_variables(int nrhs,
} }
} }
*M_ = mexGetVariable("global", "M_"); *M_ = mexGetVariable("global", "M_");
if (M_ == NULL) if (*M_ == NULL)
{ {
ostringstream tmp; ostringstream tmp;
tmp << " in main, global variable not found: M_\n"; tmp << " in main, global variable not found: M_\n";
@ -371,14 +371,14 @@ Get_Arguments_and_global_variables(int nrhs,
} }
/* Gets variables and parameters from global workspace of Matlab */ /* Gets variables and parameters from global workspace of Matlab */
*oo_ = mexGetVariable("global", "oo_"); *oo_ = mexGetVariable("global", "oo_");
if (oo_ == NULL) if (*oo_ == NULL)
{ {
ostringstream tmp; ostringstream tmp;
tmp << " in main, global variable not found: oo_\n"; tmp << " in main, global variable not found: oo_\n";
throw FatalExceptionHandling(tmp.str()); throw FatalExceptionHandling(tmp.str());
} }
*options_ = mexGetVariable("global", "options_"); *options_ = mexGetVariable("global", "options_");
if (options_ == NULL) if (*options_ == NULL)
{ {
ostringstream tmp; ostringstream tmp;
tmp << " in main, global variable not found: options_\n"; tmp << " in main, global variable not found: options_\n";

View File

@ -2411,6 +2411,12 @@ CalibSmootherStatement::CalibSmootherStatement(const SymbolList &symbol_list_arg
{ {
} }
void
CalibSmootherStatement::checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings)
{
mod_file_struct.calib_smoother_present = true;
}
void void
CalibSmootherStatement::writeOutput(ostream &output, const string &basename) const CalibSmootherStatement::writeOutput(ostream &output, const string &basename) const
{ {

View File

@ -516,6 +516,7 @@ private:
public: public:
CalibSmootherStatement(const SymbolList &symbol_list_arg, CalibSmootherStatement(const SymbolList &symbol_list_arg,
const OptionsList &options_list_arg); const OptionsList &options_list_arg);
virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
virtual void writeOutput(ostream &output, const string &basename) const; virtual void writeOutput(ostream &output, const string &basename) const;
}; };

View File

@ -123,7 +123,8 @@ ModFile::checkPass()
|| mod_file_struct.estimation_present || mod_file_struct.estimation_present
|| mod_file_struct.osr_present || mod_file_struct.osr_present
|| mod_file_struct.ramsey_policy_present || mod_file_struct.ramsey_policy_present
|| mod_file_struct.discretionary_policy_present; || mod_file_struct.discretionary_policy_present
|| mod_file_struct.calib_smoother_present;
// Allow empty model only when doing a standalone BVAR estimation // Allow empty model only when doing a standalone BVAR estimation
if (dynamic_model.equation_number() == 0 if (dynamic_model.equation_number() == 0
@ -318,7 +319,8 @@ ModFile::transformPass(bool nostrict)
|| mod_file_struct.estimation_present || mod_file_struct.estimation_present
|| mod_file_struct.osr_present || mod_file_struct.osr_present
|| mod_file_struct.ramsey_policy_present || mod_file_struct.ramsey_policy_present
|| mod_file_struct.discretionary_policy_present) || mod_file_struct.discretionary_policy_present
|| mod_file_struct.calib_smoother_present)
{ {
// In stochastic models, create auxiliary vars for leads and lags greater than 2, on both endos and exos // In stochastic models, create auxiliary vars for leads and lags greater than 2, on both endos and exos
dynamic_model.substituteEndoLeadGreaterThanTwo(false); dynamic_model.substituteEndoLeadGreaterThanTwo(false);
@ -414,8 +416,8 @@ ModFile::computingPass(bool no_tmp_terms)
// Mod file may have no equation (for example in a standalone BVAR estimation) // Mod file may have no equation (for example in a standalone BVAR estimation)
if (dynamic_model.equation_number() > 0) if (dynamic_model.equation_number() > 0)
{ {
if (nonstationary_variables) /*if (nonstationary_variables)
trend_dynamic_model.runTrendTest(global_eval_context); trend_dynamic_model.runTrendTest(global_eval_context);*/
// Compute static model and its derivatives // Compute static model and its derivatives
dynamic_model.toStatic(static_model); dynamic_model.toStatic(static_model);
@ -423,7 +425,8 @@ ModFile::computingPass(bool no_tmp_terms)
{ {
if (mod_file_struct.stoch_simul_present if (mod_file_struct.stoch_simul_present
|| mod_file_struct.estimation_present || mod_file_struct.osr_present || mod_file_struct.estimation_present || mod_file_struct.osr_present
|| mod_file_struct.ramsey_policy_present || mod_file_struct.identification_present) || mod_file_struct.ramsey_policy_present || mod_file_struct.identification_present
|| mod_file_struct.calib_smoother_present)
static_model.set_cutoff_to_zero(); static_model.set_cutoff_to_zero();
const bool static_hessian = mod_file_struct.identification_present const bool static_hessian = mod_file_struct.identification_present
@ -437,7 +440,8 @@ ModFile::computingPass(bool no_tmp_terms)
if (mod_file_struct.simul_present || mod_file_struct.check_present if (mod_file_struct.simul_present || mod_file_struct.check_present
|| mod_file_struct.stoch_simul_present || mod_file_struct.stoch_simul_present
|| mod_file_struct.estimation_present || mod_file_struct.osr_present || mod_file_struct.estimation_present || mod_file_struct.osr_present
|| mod_file_struct.ramsey_policy_present || mod_file_struct.identification_present) || mod_file_struct.ramsey_policy_present || mod_file_struct.identification_present
|| mod_file_struct.calib_smoother_present)
{ {
if (mod_file_struct.simul_present) if (mod_file_struct.simul_present)
dynamic_model.computingPass(true, false, false, false, global_eval_context, no_tmp_terms, block, use_dll, byte_code); dynamic_model.computingPass(true, false, false, false, global_eval_context, no_tmp_terms, block, use_dll, byte_code);
@ -445,7 +449,8 @@ ModFile::computingPass(bool no_tmp_terms)
{ {
if (mod_file_struct.stoch_simul_present if (mod_file_struct.stoch_simul_present
|| mod_file_struct.estimation_present || mod_file_struct.osr_present || mod_file_struct.estimation_present || mod_file_struct.osr_present
|| mod_file_struct.ramsey_policy_present || mod_file_struct.identification_present) || mod_file_struct.ramsey_policy_present || mod_file_struct.identification_present
|| mod_file_struct.calib_smoother_present)
dynamic_model.set_cutoff_to_zero(); dynamic_model.set_cutoff_to_zero();
if (mod_file_struct.order_option < 1 || mod_file_struct.order_option > 3) if (mod_file_struct.order_option < 1 || mod_file_struct.order_option > 3)
{ {

View File

@ -47,7 +47,8 @@ ModFileStructure::ModFileStructure() :
dsge_var_estimated(false), dsge_var_estimated(false),
bayesian_irf_present(false), bayesian_irf_present(false),
estimation_data_statement_present(false), estimation_data_statement_present(false),
last_markov_switching_chain(0) last_markov_switching_chain(0),
calib_smoother_present(false)
{ {
} }

View File

@ -57,6 +57,8 @@ public:
bool planner_objective_present; bool planner_objective_present;
//! Whether an extended_path statement is present //! Whether an extended_path statement is present
bool extended_path_present; bool extended_path_present;
//! Whether a calib_smoother statement is present
bool calib_smoother_present;
//! The value of the "order" option of stoch_simul, estimation, osr, ramsey_policy //! The value of the "order" option of stoch_simul, estimation, osr, ramsey_policy
//! Derivation order //! Derivation order
/*! First initialized to zero. If user sets order option somewhere in the MOD file, it will be equal to the maximum of order options. Otherwise will default to 2 */ /*! First initialized to zero. If user sets order option somewhere in the MOD file, it will be equal to the maximum of order options. Otherwise will default to 2 */