From b0c819cb03a37716adbbf73aa485993e9b44188b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org> Date: Mon, 20 Jan 2020 17:23:51 +0100 Subject: [PATCH] =?UTF-8?q?Compute=203rd=20order=20dynamic=20derivatives?= =?UTF-8?q?=20for=20=E2=80=9Cdynare=5Fsensitivity(identification)=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ref. #40 --- src/ComputingTasks.cc | 8 ++++++-- src/ModFile.cc | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/ComputingTasks.cc b/src/ComputingTasks.cc index f999bee0..955d5bbb 100644 --- a/src/ComputingTasks.cc +++ b/src/ComputingTasks.cc @@ -1275,7 +1275,11 @@ DynareSensitivityStatement::checkPass(ModFileStructure &mod_file_struct, Warning { if (auto it = options_list.num_options.find("identification"); it != options_list.num_options.end() && it->second == "1") - mod_file_struct.identification_present = true; + { + mod_file_struct.identification_present = true; + // The following triggers 3rd order derivatives, see preprocessor#40 + mod_file_struct.identification_order = max(mod_file_struct.identification_order, 2); + } mod_file_struct.sensitivity_present = true; } @@ -2731,7 +2735,7 @@ IdentificationStatement::checkPass(ModFileStructure &mod_file_struct, WarningCon mod_file_struct.identification_order = max(mod_file_struct.identification_order, order); } else - // The default value for order is 1 (which triggers 2nd order dynamic derivatives) + // The default value for order is 1 (which triggers 2nd order dynamic derivatives, see preprocessor#40) mod_file_struct.identification_order = max(mod_file_struct.identification_order, 1); } diff --git a/src/ModFile.cc b/src/ModFile.cc index 20c27c37..84e2588d 100644 --- a/src/ModFile.cc +++ b/src/ModFile.cc @@ -779,7 +779,7 @@ ModFile::computingPass(bool no_tmp_terms, FileOutputType output, int params_deri exit(EXIT_FAILURE); } int derivsOrder = max(mod_file_struct.order_option, - mod_file_struct.identification_order + 1); + mod_file_struct.identification_order + 1); // See preprocessor#40 if (mod_file_struct.sensitivity_present || linear || output == FileOutputType::second) derivsOrder = max(derivsOrder, 2); if (mod_file_struct.estimation_analytic_derivation || output == FileOutputType::third) -- GitLab