preprocessor: add option no_2nd_order_params_derivs. #1187
parent
0b922739a6
commit
c3dcc0e121
|
@ -41,7 +41,7 @@ void main2(stringstream &in, string &basename, bool debug, bool clear_all, bool
|
||||||
bool nograph, bool nointeractive, bool parallel, ConfigFile &config_file,
|
bool nograph, bool nointeractive, bool parallel, ConfigFile &config_file,
|
||||||
WarningConsolidation &warnings_arg, bool nostrict, bool check_model_changes,
|
WarningConsolidation &warnings_arg, bool nostrict, bool check_model_changes,
|
||||||
bool minimal_workspace, bool compute_xrefs, FileOutputType output_mode,
|
bool minimal_workspace, bool compute_xrefs, FileOutputType output_mode,
|
||||||
LanguageOutputType lang
|
LanguageOutputType lang, bool sec_order_param_deriv
|
||||||
#if defined(_WIN32) || defined(__CYGWIN32__)
|
#if defined(_WIN32) || defined(__CYGWIN32__)
|
||||||
, bool cygwin, bool msvc
|
, bool cygwin, bool msvc
|
||||||
#endif
|
#endif
|
||||||
|
@ -57,6 +57,7 @@ usage()
|
||||||
cerr << "Dynare usage: dynare mod_file [debug] [noclearall] [onlyclearglobals] [savemacro[=macro_file]] [onlymacro] [nolinemacro] [notmpterms] [nolog] [warn_uninit]"
|
cerr << "Dynare usage: dynare mod_file [debug] [noclearall] [onlyclearglobals] [savemacro[=macro_file]] [onlymacro] [nolinemacro] [notmpterms] [nolog] [warn_uninit]"
|
||||||
<< " [console] [nograph] [nointeractive] [parallel[=cluster_name]] [conffile=parallel_config_path_and_filename] [parallel_slave_open_mode] [parallel_test]"
|
<< " [console] [nograph] [nointeractive] [parallel[=cluster_name]] [conffile=parallel_config_path_and_filename] [parallel_slave_open_mode] [parallel_test]"
|
||||||
<< " [-D<variable>[=<value>]] [-I/path] [nostrict] [fast] [minimal_workspace] [compute_xrefs] [output=dynamic|first|second|third] [language=C|C++|julia]"
|
<< " [-D<variable>[=<value>]] [-I/path] [nostrict] [fast] [minimal_workspace] [compute_xrefs] [output=dynamic|first|second|third] [language=C|C++|julia]"
|
||||||
|
<< " [no_2nd_order_params_derivs]"
|
||||||
#if defined(_WIN32) || defined(__CYGWIN32__)
|
#if defined(_WIN32) || defined(__CYGWIN32__)
|
||||||
<< " [cygwin] [msvc]"
|
<< " [cygwin] [msvc]"
|
||||||
#endif
|
#endif
|
||||||
|
@ -90,6 +91,7 @@ main(int argc, char **argv)
|
||||||
bool no_line_macro = false;
|
bool no_line_macro = false;
|
||||||
bool no_log = false;
|
bool no_log = false;
|
||||||
bool no_warn = false;
|
bool no_warn = false;
|
||||||
|
bool sec_order_param_deriv = true;
|
||||||
bool warn_uninit = false;
|
bool warn_uninit = false;
|
||||||
bool console = false;
|
bool console = false;
|
||||||
bool nograph = false;
|
bool nograph = false;
|
||||||
|
@ -119,6 +121,8 @@ main(int argc, char **argv)
|
||||||
debug = true;
|
debug = true;
|
||||||
else if (!strcmp(argv[arg], "noclearall"))
|
else if (!strcmp(argv[arg], "noclearall"))
|
||||||
clear_all = false;
|
clear_all = false;
|
||||||
|
else if (!strcmp(argv[arg], "no_2nd_order_params_derivs"))
|
||||||
|
sec_order_param_deriv = false;
|
||||||
else if (!strcmp(argv[arg], "onlyclearglobals"))
|
else if (!strcmp(argv[arg], "onlyclearglobals"))
|
||||||
{
|
{
|
||||||
clear_all = false;
|
clear_all = false;
|
||||||
|
@ -318,7 +322,7 @@ main(int argc, char **argv)
|
||||||
main2(macro_output, basename, debug, clear_all, clear_global,
|
main2(macro_output, basename, debug, clear_all, clear_global,
|
||||||
no_tmp_terms, no_log, no_warn, warn_uninit, console, nograph, nointeractive,
|
no_tmp_terms, no_log, no_warn, warn_uninit, console, nograph, nointeractive,
|
||||||
parallel, config_file, warnings, nostrict, check_model_changes, minimal_workspace,
|
parallel, config_file, warnings, nostrict, check_model_changes, minimal_workspace,
|
||||||
compute_xrefs, output_mode, language
|
compute_xrefs, output_mode, language, sec_order_param_deriv
|
||||||
#if defined(_WIN32) || defined(__CYGWIN32__)
|
#if defined(_WIN32) || defined(__CYGWIN32__)
|
||||||
, cygwin, msvc
|
, cygwin, msvc
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -30,7 +30,7 @@ main2(stringstream &in, string &basename, bool debug, bool clear_all, bool clear
|
||||||
bool nograph, bool nointeractive, bool parallel, ConfigFile &config_file,
|
bool nograph, bool nointeractive, bool parallel, ConfigFile &config_file,
|
||||||
WarningConsolidation &warnings, bool nostrict, bool check_model_changes,
|
WarningConsolidation &warnings, bool nostrict, bool check_model_changes,
|
||||||
bool minimal_workspace, bool compute_xrefs, FileOutputType output_mode,
|
bool minimal_workspace, bool compute_xrefs, FileOutputType output_mode,
|
||||||
LanguageOutputType language
|
LanguageOutputType language, bool sec_order_param_deriv
|
||||||
#if defined(_WIN32) || defined(__CYGWIN32__)
|
#if defined(_WIN32) || defined(__CYGWIN32__)
|
||||||
, bool cygwin, bool msvc
|
, bool cygwin, bool msvc
|
||||||
#endif
|
#endif
|
||||||
|
@ -51,7 +51,7 @@ main2(stringstream &in, string &basename, bool debug, bool clear_all, bool clear
|
||||||
mod_file->evalAllExpressions(warn_uninit);
|
mod_file->evalAllExpressions(warn_uninit);
|
||||||
|
|
||||||
// Do computations
|
// Do computations
|
||||||
mod_file->computingPass(no_tmp_terms, output_mode, compute_xrefs);
|
mod_file->computingPass(no_tmp_terms, output_mode, compute_xrefs, sec_order_param_deriv);
|
||||||
|
|
||||||
// Write outputs
|
// Write outputs
|
||||||
if (output_mode != none)
|
if (output_mode != none)
|
||||||
|
|
14
ModFile.cc
14
ModFile.cc
|
@ -469,7 +469,7 @@ ModFile::transformPass(bool nostrict)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ModFile::computingPass(bool no_tmp_terms, FileOutputType output, bool compute_xrefs)
|
ModFile::computingPass(bool no_tmp_terms, FileOutputType output, bool compute_xrefs, bool sec_order_param_deriv)
|
||||||
{
|
{
|
||||||
// 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)
|
||||||
|
@ -490,10 +490,10 @@ ModFile::computingPass(bool no_tmp_terms, FileOutputType output, bool compute_xr
|
||||||
const bool static_hessian = mod_file_struct.identification_present
|
const bool static_hessian = mod_file_struct.identification_present
|
||||||
|| mod_file_struct.estimation_analytic_derivation;
|
|| mod_file_struct.estimation_analytic_derivation;
|
||||||
FileOutputType paramsDerivatives = none;
|
FileOutputType paramsDerivatives = none;
|
||||||
if (mod_file_struct.identification_present)
|
|
||||||
paramsDerivatives = first;
|
|
||||||
if (mod_file_struct.estimation_analytic_derivation)
|
if (mod_file_struct.estimation_analytic_derivation)
|
||||||
paramsDerivatives = third;
|
paramsDerivatives = third;
|
||||||
|
if (mod_file_struct.identification_present || !sec_order_param_deriv)
|
||||||
|
paramsDerivatives = first;
|
||||||
static_model.computingPass(global_eval_context, no_tmp_terms, static_hessian,
|
static_model.computingPass(global_eval_context, no_tmp_terms, static_hessian,
|
||||||
false, paramsDerivatives, block, byte_code);
|
false, paramsDerivatives, block, byte_code);
|
||||||
}
|
}
|
||||||
|
@ -527,10 +527,10 @@ ModFile::computingPass(bool no_tmp_terms, FileOutputType output, bool compute_xr
|
||||||
|| mod_file_struct.estimation_analytic_derivation
|
|| mod_file_struct.estimation_analytic_derivation
|
||||||
|| output == third;
|
|| output == third;
|
||||||
FileOutputType paramsDerivatives = none;
|
FileOutputType paramsDerivatives = none;
|
||||||
if (mod_file_struct.identification_present)
|
|
||||||
paramsDerivatives = first;
|
|
||||||
if (mod_file_struct.estimation_analytic_derivation)
|
if (mod_file_struct.estimation_analytic_derivation)
|
||||||
paramsDerivatives = third;
|
paramsDerivatives = third;
|
||||||
|
if (mod_file_struct.identification_present || !sec_order_param_deriv)
|
||||||
|
paramsDerivatives = first;
|
||||||
dynamic_model.computingPass(true, hessian, thirdDerivatives, paramsDerivatives, global_eval_context, no_tmp_terms, block, use_dll, byte_code, compute_xrefs);
|
dynamic_model.computingPass(true, hessian, thirdDerivatives, paramsDerivatives, global_eval_context, no_tmp_terms, block, use_dll, byte_code, compute_xrefs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,7 +132,8 @@ public:
|
||||||
//! Execute computations
|
//! Execute computations
|
||||||
/*! \param no_tmp_terms if true, no temporary terms will be computed in the static and dynamic files */
|
/*! \param no_tmp_terms if true, no temporary terms will be computed in the static and dynamic files */
|
||||||
/*! \param compute_xrefs if true, equation cross references will be computed */
|
/*! \param compute_xrefs if true, equation cross references will be computed */
|
||||||
void computingPass(bool no_tmp_terms, FileOutputType output, bool compute_xrefs);
|
/*! \param sec_order_param_deriv if true, compute second order param derivatives*/
|
||||||
|
void computingPass(bool no_tmp_terms, FileOutputType output, bool compute_xrefs, bool sec_order_param_deriv);
|
||||||
//! Writes Matlab/Octave output files
|
//! Writes Matlab/Octave 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
|
||||||
|
|
Loading…
Reference in New Issue