Commit fad44096 authored by sebastien's avatar sebastien
Browse files

trunk preprocessor: added option "notmpterms" to dynare command, for disabling...

trunk preprocessor: added option "notmpterms" to dynare command, for disabling temporary terms in static and dynamic files


git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@2226 ac1d8469-bf42-47a9-8791-bf33cf982152
parent 22bf852e
...@@ -840,7 +840,7 @@ void ...@@ -840,7 +840,7 @@ void
PlannerObjectiveStatement::computingPass() PlannerObjectiveStatement::computingPass()
{ {
model_tree->computeStaticHessian = true; model_tree->computeStaticHessian = true;
model_tree->computingPass(eval_context_type()); model_tree->computingPass(eval_context_type(), false);
} }
void void
......
...@@ -32,7 +32,7 @@ using namespace std; ...@@ -32,7 +32,7 @@ using namespace std;
Splitting main() in two parts was necessary because ParsingDriver.h and MacroDriver.h can't be Splitting main() in two parts was necessary because ParsingDriver.h and MacroDriver.h can't be
included simultaneously (because of Bison limitations). included simultaneously (because of Bison limitations).
*/ */
void main2(stringstream &in, string &basename, bool debug, bool clear_all); void main2(stringstream &in, string &basename, bool debug, bool clear_all, bool no_tmp_terms);
int int
main(int argc, char** argv) main(int argc, char** argv)
...@@ -47,6 +47,7 @@ main(int argc, char** argv) ...@@ -47,6 +47,7 @@ main(int argc, char** argv)
bool clear_all = true; bool clear_all = true;
bool save_macro = false; bool save_macro = false;
bool debug = false; bool debug = false;
bool no_tmp_terms = false;
// Parse options // Parse options
for (int arg = 2; arg < argc; arg++) for (int arg = 2; arg < argc; arg++)
...@@ -57,6 +58,8 @@ main(int argc, char** argv) ...@@ -57,6 +58,8 @@ main(int argc, char** argv)
clear_all = false; clear_all = false;
else if (string(argv[arg]) == string("savemacro")) else if (string(argv[arg]) == string("savemacro"))
save_macro = true; save_macro = true;
else if (string(argv[arg]) == string("notmpterms"))
no_tmp_terms = true;
} }
cout << "Starting Dynare ..." << endl cout << "Starting Dynare ..." << endl
...@@ -86,7 +89,7 @@ main(int argc, char** argv) ...@@ -86,7 +89,7 @@ main(int argc, char** argv)
} }
// Do the rest // Do the rest
main2(macro_output, basename, debug, clear_all); main2(macro_output, basename, debug, clear_all, no_tmp_terms);
return 0; return 0;
} }
...@@ -25,7 +25,7 @@ using namespace std; ...@@ -25,7 +25,7 @@ using namespace std;
#include "ModFile.hh" #include "ModFile.hh"
void void
main2(stringstream &in, string &basename, bool debug, bool clear_all) main2(stringstream &in, string &basename, bool debug, bool clear_all, bool no_tmp_terms)
{ {
ParsingDriver p; ParsingDriver p;
...@@ -36,7 +36,7 @@ main2(stringstream &in, string &basename, bool debug, bool clear_all) ...@@ -36,7 +36,7 @@ main2(stringstream &in, string &basename, bool debug, bool clear_all)
mod_file->checkPass(); mod_file->checkPass();
// Do computations // Do computations
mod_file->computingPass(); mod_file->computingPass(no_tmp_terms);
// Write outputs // Write outputs
mod_file->writeOutputFiles(basename, clear_all); mod_file->writeOutputFiles(basename, clear_all);
......
...@@ -91,7 +91,7 @@ ModFile::checkPass() ...@@ -91,7 +91,7 @@ ModFile::checkPass()
} }
void void
ModFile::computingPass() 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 (model_tree.equation_number() > 0) if (model_tree.equation_number() > 0)
...@@ -113,7 +113,7 @@ ModFile::computingPass() ...@@ -113,7 +113,7 @@ ModFile::computingPass()
model_tree.computeThirdDerivatives = true; model_tree.computeThirdDerivatives = true;
} }
model_tree.computingPass(global_eval_context); model_tree.computingPass(global_eval_context, no_tmp_terms);
} }
for(vector<Statement *>::iterator it = statements.begin(); for(vector<Statement *>::iterator it = statements.begin();
......
...@@ -3140,7 +3140,7 @@ ModelTree::BlockLinear(Model_Block *ModelBlock) ...@@ -3140,7 +3140,7 @@ ModelTree::BlockLinear(Model_Block *ModelBlock)
} }
void void
ModelTree::computingPass(const eval_context_type &eval_context) ModelTree::computingPass(const eval_context_type &eval_context, bool no_tmp_terms)
{ {
cout << equations.size() << " equation(s) found" << endl; cout << equations.size() << " equation(s) found" << endl;
...@@ -3171,10 +3171,12 @@ ModelTree::computingPass(const eval_context_type &eval_context) ...@@ -3171,10 +3171,12 @@ ModelTree::computingPass(const eval_context_type &eval_context)
block_triangular.Normalize_and_BlockDecompose_Static_0_Model(j_m); block_triangular.Normalize_and_BlockDecompose_Static_0_Model(j_m);
BlockLinear(block_triangular.ModelBlock); BlockLinear(block_triangular.ModelBlock);
computeTemporaryTermsOrdered(order, block_triangular.ModelBlock); if (!no_tmp_terms)
computeTemporaryTermsOrdered(order, block_triangular.ModelBlock);
} }
else else
computeTemporaryTerms(order); if (!no_tmp_terms)
computeTemporaryTerms(order);
} }
void void
......
...@@ -434,6 +434,7 @@ public: ...@@ -434,6 +434,7 @@ public:
/*! \todo check there are only endogenous variables at the current period in the objective /*! \todo check there are only endogenous variables at the current period in the objective
(no exogenous, no lead/lag) */ (no exogenous, no lead/lag) */
virtual void checkPass(ModFileStructure &mod_file_struct); virtual void checkPass(ModFileStructure &mod_file_struct);
/*! \todo allow for the possibility of disabling temporary terms */
virtual void computingPass(); virtual void computingPass();
virtual void writeOutput(ostream &output, const string &basename) const; virtual void writeOutput(ostream &output, const string &basename) const;
}; };
......
...@@ -63,7 +63,8 @@ public: ...@@ -63,7 +63,8 @@ public:
/*! \todo add check for number of equations and endogenous if ramsey_policy is present */ /*! \todo add check for number of equations and endogenous if ramsey_policy is present */
void checkPass(); void checkPass();
//! Execute computations //! Execute computations
void computingPass(); /*! \param no_tmp_terms if true, no temporary terms will be computed in the static and dynamic files */
void computingPass(bool no_tmp_terms);
//! Writes Matlab/Scilab output files //! Writes Matlab/Scilab output files
/*! /*!
\param basename The base name used for writing output files. Should be the name of the mod file without its extension \param basename The base name used for writing output files. Should be the name of the mod file without its extension
......
...@@ -157,8 +157,9 @@ public: ...@@ -157,8 +157,9 @@ public:
//! Whether dynamic third order derivatives (w.r. to endogenous and exogenous) should be written //! Whether dynamic third order derivatives (w.r. to endogenous and exogenous) should be written
bool computeThirdDerivatives; bool computeThirdDerivatives;
//! Execute computations (variable sorting + derivation) //! Execute computations (variable sorting + derivation)
/*! You must set computeJacobian, computeJacobianExo, computeHessian, computeStaticHessian and computeThirdDerivatives to correct values before calling this function */ /*! You must set computeJacobian, computeJacobianExo, computeHessian, computeStaticHessian and computeThirdDerivatives to correct values before calling this function
void computingPass(const eval_context_type &eval_context); \param no_tmp_terms if true, no temporary terms will be computed in the static and dynamic files */
void computingPass(const eval_context_type &eval_context, bool no_tmp_terms);
//! Writes model initialization and lead/lag incidence matrix to output //! Writes model initialization and lead/lag incidence matrix to output
void writeOutput(ostream &output) const; void writeOutput(ostream &output) const;
//! Writes static model file //! Writes static model file
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment