From 4948adf2cd97df11bef6662f06c74d0fd33306f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org> Date: Wed, 29 Apr 2020 17:44:57 +0200 Subject: [PATCH] Block decomposition: remove unused data structure --- src/DynamicModel.cc | 16 +--------------- src/DynamicModel.hh | 5 ----- src/ModelTree.cc | 4 +--- src/ModelTree.hh | 2 +- src/StaticModel.cc | 2 +- src/StaticModel.hh | 4 ---- 6 files changed, 4 insertions(+), 29 deletions(-) diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc index 20bbde1e..9369fc6b 100644 --- a/src/DynamicModel.cc +++ b/src/DynamicModel.cc @@ -88,7 +88,6 @@ DynamicModel::DynamicModel(const DynamicModel &m) : block_exo_index{m.block_exo_index}, block_det_exo_index{m.block_det_exo_index}, block_other_endo_index{m.block_other_endo_index}, - variable_block_lead_lag{m.variable_block_lead_lag}, var_expectation_functions_to_write{m.var_expectation_functions_to_write} { copyHelper(m); @@ -141,7 +140,6 @@ DynamicModel::operator=(const DynamicModel &m) block_exo_index = m.block_exo_index; block_det_exo_index = m.block_det_exo_index; block_other_endo_index = m.block_other_endo_index; - variable_block_lead_lag = m.variable_block_lead_lag; var_expectation_functions_to_write = m.var_expectation_functions_to_write; copyHelper(m); @@ -4812,7 +4810,7 @@ DynamicModel::computingPass(bool jacobianExo, int derivsOrder, int paramsDerivsO cout << "Finding the optimal block decomposition of the model ..." << endl; - auto variable_lag_lead = computeBlockDecompositionAndFeedbackVariablesForEachBlock(); + computeBlockDecompositionAndFeedbackVariablesForEachBlock(); reduceBlocksAndTypeDetermination(linear_decomposition); @@ -4829,18 +4827,6 @@ DynamicModel::computingPass(bool jacobianExo, int derivsOrder, int paramsDerivsO global_temporary_terms = true; if (!no_tmp_terms) computeTemporaryTermsOrdered(); - int k = 0; - variable_block_lead_lag.clear(); - variable_block_lead_lag.resize(equations.size()); - for (int i = 0; i < static_cast<int>(blocks.size()); i++) - { - for (int j = 0; j < blocks[i].size; j++) - { - int l = endo_idx_block2orig[k]; - variable_block_lead_lag[l] = { i, variable_lag_lead[l].first, variable_lag_lead[l].second }; - k++; - } - } } else { diff --git a/src/DynamicModel.hh b/src/DynamicModel.hh index 9cd29c13..4f3d419e 100644 --- a/src/DynamicModel.hh +++ b/src/DynamicModel.hh @@ -203,11 +203,6 @@ private: //! Write reverse cross references void writeRevXrefs(ostream &output, const map<pair<int, int>, set<int>> &xrefmap, const string &type) const; - //! List for each variable its block number and its maximum lag and lead inside the block - vector<tuple<int, int, int>> variable_block_lead_lag; - //! List for each equation its block number - vector<int> equation_block; - //! Used for var_expectation and var_model map<string, set<int>> var_expectation_functions_to_write; diff --git a/src/ModelTree.cc b/src/ModelTree.cc index 3b45efa2..207c9d99 100644 --- a/src/ModelTree.cc +++ b/src/ModelTree.cc @@ -647,7 +647,7 @@ ModelTree::getVariableLeadLagByBlock() const return { equation_lag_lead, variable_lag_lead }; } -lag_lead_vector_t +void ModelTree::computeBlockDecompositionAndFeedbackVariablesForEachBlock() { int nb_var = symbol_table.endo_nbr(); @@ -783,8 +783,6 @@ ModelTree::computeBlockDecompositionAndFeedbackVariablesForEachBlock() } updateReverseVariableEquationOrderings(); - - return variable_lag_lead; } void diff --git a/src/ModelTree.hh b/src/ModelTree.hh index d7a2adb9..87acc746 100644 --- a/src/ModelTree.hh +++ b/src/ModelTree.hh @@ -304,7 +304,7 @@ protected: Initializes the “blocks” structure, and fills the following fields: size, mfs_size, n_static, n_forward, n_backward, n_mixed. Also initializes the endo2block and eq2block structures. */ - lag_lead_vector_t computeBlockDecompositionAndFeedbackVariablesForEachBlock(); + void computeBlockDecompositionAndFeedbackVariablesForEachBlock(); /* Reduce the number of block by merging the same type of equations in the prologue and the epilogue, and determine the type of each block. diff --git a/src/StaticModel.cc b/src/StaticModel.cc index e7c84cad..6df1a0c5 100644 --- a/src/StaticModel.cc +++ b/src/StaticModel.cc @@ -1133,7 +1133,7 @@ StaticModel::computingPass(int derivsOrder, int paramsDerivsOrder, const eval_co cout << "Finding the optimal block decomposition of the model ..." << endl; - auto variable_lag_lead = computeBlockDecompositionAndFeedbackVariablesForEachBlock(); + computeBlockDecompositionAndFeedbackVariablesForEachBlock(); reduceBlocksAndTypeDetermination(false); diff --git a/src/StaticModel.hh b/src/StaticModel.hh index 1a93f313..6a49dcd1 100644 --- a/src/StaticModel.hh +++ b/src/StaticModel.hh @@ -96,10 +96,6 @@ private: //! Indicate if the temporary terms are computed for the overall model (true) or not (false). Default value true bool global_temporary_terms{true}; - //!List for each block and for each lag-leag all the other endogenous variables and exogenous variables - using var_t = set<int>; - using lag_var_t = map<int, var_t>; - //! Helper functions for writeStaticModel void writeStaticModelHelper(const string &basename, const string &name, const string &retvalname, -- GitLab