preprocessor: fix bug in conditional_forecast_paths where the shocked endogenous variable id was provided as symb_id instead of type specific symb_id. #1276
parent
e31f0a8d0f
commit
833f8c7845
|
@ -2098,7 +2098,7 @@ ParsingDriver::plot_conditional_forecast(string *periods)
|
||||||
void
|
void
|
||||||
ParsingDriver::conditional_forecast_paths()
|
ParsingDriver::conditional_forecast_paths()
|
||||||
{
|
{
|
||||||
mod_file->addStatement(new ConditionalForecastPathsStatement(det_shocks));
|
mod_file->addStatement(new ConditionalForecastPathsStatement(det_shocks, mod_file->symbol_table));
|
||||||
det_shocks.clear();
|
det_shocks.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -352,8 +352,10 @@ MShocksStatement::writeOutput(ostream &output, const string &basename, bool mini
|
||||||
writeDetShocks(output);
|
writeDetShocks(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConditionalForecastPathsStatement::ConditionalForecastPathsStatement(const AbstractShocksStatement::det_shocks_t &paths_arg) :
|
ConditionalForecastPathsStatement::ConditionalForecastPathsStatement(const AbstractShocksStatement::det_shocks_t &paths_arg,
|
||||||
|
const SymbolTable &symbol_table_arg) :
|
||||||
paths(paths_arg),
|
paths(paths_arg),
|
||||||
|
symbol_table(symbol_table_arg),
|
||||||
path_length(-1)
|
path_length(-1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -393,11 +395,11 @@ ConditionalForecastPathsStatement::writeOutput(ostream &output, const string &ba
|
||||||
{
|
{
|
||||||
if (it == paths.begin())
|
if (it == paths.begin())
|
||||||
{
|
{
|
||||||
output << "constrained_vars_ = " << it->first +1 << ";" << endl;
|
output << "constrained_vars_ = " << symbol_table.getTypeSpecificID(it->first) + 1 << ";" << endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
output << "constrained_vars_ = [constrained_vars_; " << it->first +1 << "];" << endl;
|
output << "constrained_vars_ = [constrained_vars_; " << symbol_table.getTypeSpecificID(it->first) + 1 << "];" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -94,9 +94,11 @@ class ConditionalForecastPathsStatement : public Statement
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
const AbstractShocksStatement::det_shocks_t paths;
|
const AbstractShocksStatement::det_shocks_t paths;
|
||||||
|
const SymbolTable &symbol_table;
|
||||||
int path_length;
|
int path_length;
|
||||||
public:
|
public:
|
||||||
ConditionalForecastPathsStatement(const AbstractShocksStatement::det_shocks_t &paths_arg);
|
ConditionalForecastPathsStatement(const AbstractShocksStatement::det_shocks_t &paths_arg,
|
||||||
|
const SymbolTable &symbol_table_arg);
|
||||||
virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
|
virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
|
||||||
virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const;
|
virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue