take care of extra exos in estimated_params

issue#70
Houtan Bastani 2015-04-02 17:42:01 +02:00
parent e4b10c4ec6
commit 27a69b8cec
2 changed files with 27 additions and 0 deletions

View File

@ -874,6 +874,32 @@ EstimatedParamsStatement::checkPass(ModFileStructure &mod_file_struct, WarningCo
mod_file_struct.estimated_parameters.insert(symbol_table.getID(it->name));
}
Statement *
EstimatedParamsStatement::cloneAndReindexSymbIds(DataTree &dynamic_datatree, SymbolTable &orig_symbol_table)
{
vector<EstimationParams> new_estim_params_list;
SymbolTable *new_symbol_table = dynamic_datatree.getSymbolTable();
try
{
for (vector<EstimationParams>::const_iterator it = estim_params_list.begin();
it != estim_params_list.end(); it++)
if (!it->name2.empty())
{
new_symbol_table->getID(it->name);
new_symbol_table->getID(it->name2);
}
else
new_symbol_table->getID(it->name);
}
catch (SymbolTable::UnknownSymbolNameException &e)
{
cerr << "ERROR: A variable in the estimated_params statement was not found in the symbol table" << endl
<< " This likely means that you have declared a varexo that is not used in the model" << endl;
exit(EXIT_FAILURE);
}
return new EstimatedParamsStatement(estim_params_list, *new_symbol_table);
}
void
EstimatedParamsStatement::writeOutput(ostream &output, const string &basename) const
{

View File

@ -318,6 +318,7 @@ public:
const SymbolTable &symbol_table_arg);
virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
virtual void writeOutput(ostream &output, const string &basename) const;
virtual Statement *cloneAndReindexSymbIds(DataTree &dynamic_datatree, SymbolTable &orig_symbol_table);
};
class EstimatedParamsInitStatement : public Statement