- get rid of block and bytcode variable in SimulStatement and StochSimulStatement
- minimalist version of dynamicmodel when no dynamic model is needed git-svn-id: https://www.dynare.org/svn/dynare/trunk@2883 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
74232e9ee5
commit
164eb22f87
|
@ -79,8 +79,8 @@ void ModelInfoStatement::writeOutput(ostream &output, const string &basename) co
|
|||
}
|
||||
|
||||
|
||||
SimulStatement::SimulStatement(const OptionsList &options_list_arg, bool block_arg, bool byte_code_arg) :
|
||||
options_list(options_list_arg), byte_code(byte_code_arg), block(block_arg)
|
||||
SimulStatement::SimulStatement(const OptionsList &options_list_arg) :
|
||||
options_list(options_list_arg)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -98,11 +98,9 @@ SimulStatement::writeOutput(ostream &output, const string &basename) const
|
|||
}
|
||||
|
||||
StochSimulStatement::StochSimulStatement(const SymbolList &symbol_list_arg,
|
||||
const OptionsList &options_list_arg,
|
||||
bool block_arg) :
|
||||
const OptionsList &options_list_arg) :
|
||||
symbol_list(symbol_list_arg),
|
||||
options_list(options_list_arg),
|
||||
block(block_arg)
|
||||
options_list(options_list_arg)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -130,10 +128,7 @@ StochSimulStatement::writeOutput(ostream &output, const string &basename) const
|
|||
{
|
||||
options_list.writeOutput(output);
|
||||
symbol_list.writeOutput("var_list_", output);
|
||||
if (!block)
|
||||
output << "info = stoch_simul(var_list_);" << endl;
|
||||
else
|
||||
output << "info = stoch_simul_sparse(var_list_);" << endl;
|
||||
}
|
||||
|
||||
ForecastStatement::ForecastStatement(const SymbolList &symbol_list_arg,
|
||||
|
|
|
@ -52,10 +52,8 @@ class SimulStatement : public Statement
|
|||
{
|
||||
private:
|
||||
const OptionsList options_list;
|
||||
const bool byte_code;
|
||||
const bool block;
|
||||
public:
|
||||
SimulStatement(const OptionsList &options_list_arg, bool block_arg, bool byte_code_arg);
|
||||
SimulStatement(const OptionsList &options_list_arg);
|
||||
virtual void checkPass(ModFileStructure &mod_file_struct);
|
||||
virtual void writeOutput(ostream &output, const string &basename) const;
|
||||
};
|
||||
|
@ -75,11 +73,9 @@ class StochSimulStatement : public Statement
|
|||
private:
|
||||
const SymbolList symbol_list;
|
||||
const OptionsList options_list;
|
||||
bool block;
|
||||
public:
|
||||
StochSimulStatement(const SymbolList &symbol_list_arg,
|
||||
const OptionsList &options_list_arg,
|
||||
bool block_arg);
|
||||
const OptionsList &options_list_arg);
|
||||
virtual void checkPass(ModFileStructure &mod_file_struct);
|
||||
virtual void writeOutput(ostream &output, const string &basename) const;
|
||||
};
|
||||
|
|
|
@ -154,6 +154,9 @@ void
|
|||
ModFile::computingPass(bool no_tmp_terms)
|
||||
{
|
||||
// Mod file may have no equation (for example in a standalone BVAR estimation)
|
||||
bool dynamic_model_needed = mod_file_struct.simul_present || mod_file_struct.check_present || mod_file_struct.stoch_simul_present
|
||||
|| mod_file_struct.estimation_present|| mod_file_struct.forecast_present || mod_file_struct.osr_present
|
||||
|| mod_file_struct.ramsey_policy_present;
|
||||
if (dynamic_model.equation_number() > 0)
|
||||
{
|
||||
// Compute static model and its derivatives
|
||||
|
@ -168,7 +171,8 @@ ModFile::computingPass(bool no_tmp_terms)
|
|||
static_model.computingPass(block, false, no_tmp_terms);
|
||||
}
|
||||
// Set things to compute for dynamic model
|
||||
|
||||
if (dynamic_model_needed)
|
||||
{
|
||||
if (mod_file_struct.simul_present)
|
||||
dynamic_model.computingPass(false, false, false, false, global_eval_context, no_tmp_terms, block, use_dll);
|
||||
else
|
||||
|
@ -184,6 +188,9 @@ ModFile::computingPass(bool no_tmp_terms)
|
|||
dynamic_model.computingPass(true, hessian, thirdDerivatives, paramsDerivatives, global_eval_context, no_tmp_terms, false, use_dll);
|
||||
}
|
||||
}
|
||||
else
|
||||
dynamic_model.computingPass(true, false, false, false, global_eval_context, no_tmp_terms, false, false);
|
||||
}
|
||||
|
||||
for(vector<Statement *>::iterator it = statements.begin();
|
||||
it != statements.end(); it++)
|
||||
|
@ -194,7 +201,9 @@ void
|
|||
ModFile::writeOutputFiles(const string &basename, bool clear_all) const
|
||||
{
|
||||
ofstream mOutputFile;
|
||||
|
||||
bool dynamic_model_needed = mod_file_struct.simul_present || mod_file_struct.check_present || mod_file_struct.stoch_simul_present
|
||||
|| mod_file_struct.estimation_present|| mod_file_struct.forecast_present || mod_file_struct.osr_present
|
||||
|| mod_file_struct.ramsey_policy_present;
|
||||
if (basename.size())
|
||||
{
|
||||
string fname(basename);
|
||||
|
@ -269,7 +278,10 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all) const
|
|||
|
||||
if (dynamic_model.equation_number() > 0)
|
||||
{
|
||||
if(dynamic_model_needed)
|
||||
dynamic_model.writeOutput(mOutputFile, basename, block, byte_code, use_dll);
|
||||
else
|
||||
dynamic_model.writeOutput(mOutputFile, basename, false, false, false);
|
||||
if (!byte_code)
|
||||
static_model.writeOutput(mOutputFile, block);
|
||||
}
|
||||
|
@ -296,9 +308,17 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all) const
|
|||
static_dll_model.writeStaticFile(basename, block);
|
||||
else
|
||||
static_model.writeStaticFile(basename, block);
|
||||
if(dynamic_model_needed)
|
||||
{
|
||||
dynamic_model.writeDynamicFile(basename, block, byte_code, use_dll);
|
||||
dynamic_model.writeParamsDerivativesFile(basename);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*dynamic_model.writeDynamicFile(basename, false, false, false);
|
||||
dynamic_model.writeParamsDerivativesFile(basename);*/
|
||||
}
|
||||
}
|
||||
|
||||
cout << "done" << endl;
|
||||
}
|
||||
|
|
|
@ -694,7 +694,7 @@ void ParsingDriver::rplot()
|
|||
|
||||
void ParsingDriver::stoch_simul()
|
||||
{
|
||||
mod_file->addStatement(new StochSimulStatement(symbol_list, options_list, mod_file->block));
|
||||
mod_file->addStatement(new StochSimulStatement(symbol_list, options_list));
|
||||
symbol_list.clear();
|
||||
options_list.clear();
|
||||
}
|
||||
|
@ -702,7 +702,7 @@ void ParsingDriver::stoch_simul()
|
|||
void
|
||||
ParsingDriver::simul()
|
||||
{
|
||||
mod_file->addStatement(new SimulStatement(options_list, mod_file->block, mod_file->byte_code));
|
||||
mod_file->addStatement(new SimulStatement(options_list));
|
||||
options_list.clear();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue