From 0ddf45df1575ad52efd77d294eeadc7dd5e68810 Mon Sep 17 00:00:00 2001 From: Michel Juillard Date: Tue, 31 Mar 2015 15:47:04 +0200 Subject: [PATCH 1/4] fixing bug in treatment of temporary terms for blocks with *.m files --- DynamicModel.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/DynamicModel.cc b/DynamicModel.cc index 645fa646..1de6bc8c 100644 --- a/DynamicModel.cc +++ b/DynamicModel.cc @@ -187,6 +187,10 @@ DynamicModel::computeTemporaryTermsOrdered() it->second->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block); for (derivative_t::const_iterator it = derivative_other_endo[block].begin(); it != derivative_other_endo[block].end(); it++) it->second->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block); + for (derivative_t::const_iterator it = derivative_exo[block].begin(); it != derivative_exo[block].end(); it++) + it->second->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block); + for (derivative_t::const_iterator it = derivative_exo_det[block].begin(); it != derivative_exo_det[block].end(); it++) + it->second->collectTemporary_terms(temporary_terms, temporary_terms_in_use, block); v_temporary_terms_inuse[block] = temporary_terms_in_use; } computeTemporaryTermsMapping(); From fa6a08e8c54389280f214412defc11940f7bac71 Mon Sep 17 00:00:00 2001 From: Michel Juillard Date: Thu, 23 Jul 2015 14:25:18 +0200 Subject: [PATCH 2/4] histval: replaced initialization with NaN by zeros --- NumericalInitialization.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NumericalInitialization.cc b/NumericalInitialization.cc index 85055905..f8491d8b 100644 --- a/NumericalInitialization.cc +++ b/NumericalInitialization.cc @@ -274,7 +274,7 @@ HistValStatement::writeOutput(ostream &output, const string &basename, bool mini output << "%" << endl << "% HISTVAL instructions" << endl << "%" << endl - << "M_.endo_histval = zeros(M_.endo_nbr,M_.maximum_endo_lag);" << endl; + << "M_.endo_histval = zeros(M_.endo_nbr,M_.maximum_lag);" << endl; for (hist_values_t::const_iterator it = hist_values.begin(); it != hist_values.end(); it++) @@ -310,7 +310,7 @@ HistValStatement::writeOutput(ostream &output, const string &basename, bool mini int tsid = symbol_table.getTypeSpecificID(symb_id) + 1; if (type == eEndogenous) - output << "M_.endo_histval( " << tsid << ", M_.maximum_endo_lag + " << lag << ") = "; + output << "M_.endo_histval( " << tsid << ", M_.maximum_lag + " << lag << ") = "; else if (type == eExogenous) output << "oo_.exo_simul( M_.maximum_lag + " << lag << ", " << tsid << " ) = "; else if (type != eExogenousDet) From ab65c1abc285e89e672fa05c3beaf715ddbade28 Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Thu, 23 Jul 2015 18:10:44 +0200 Subject: [PATCH 3/4] preprocessor: clean up code --- SymbolTable.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/SymbolTable.cc b/SymbolTable.cc index 2c1a699c..edf92762 100644 --- a/SymbolTable.cc +++ b/SymbolTable.cc @@ -282,11 +282,9 @@ SymbolTable::writeOutput(ostream &output) const throw (NotYetFrozenException) int ic = 1; output << "options_.varobs = cell(1);" << endl; for (vector::const_iterator it = varobs.begin(); - it != varobs.end(); it++) - { - output << "options_.varobs(" << ic << ") = {'" << getName(*it) << "'};" << endl; - ic++; - } + it != varobs.end(); it++, ic++) + output << "options_.varobs(" << ic << ") = {'" << getName(*it) << "'};" << endl; + output << "options_.varobs_id = [ "; for (vector::const_iterator it = varobs.begin(); it != varobs.end(); it++) From 22ac2f4f9211907aa341bcb5931408ab7139d68c Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Wed, 29 Jul 2015 14:52:15 +0200 Subject: [PATCH 4/4] preprocessor: simplify writing of NNZDerivatives --- DynamicModel.cc | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/DynamicModel.cc b/DynamicModel.cc index b6f7e3e7..70b16176 100644 --- a/DynamicModel.cc +++ b/DynamicModel.cc @@ -2862,20 +2862,17 @@ DynamicModel::writeOutput(ostream &output, const string &basename, bool block_de // Write number of non-zero derivatives // Use -1 if the derivatives have not been computed - output << "M_.NNZDerivatives = zeros(3, 1);" << endl - << "M_.NNZDerivatives(1) = " << NNZDerivatives[0] << ";" << endl; + output << "M_.NNZDerivatives = [" << NNZDerivatives[0] << "; "; if (order > 1) - { - output << "M_.NNZDerivatives(2) = " << NNZDerivatives[1] << ";" << endl; - if (order > 2) - output << "M_.NNZDerivatives(3) = " << NNZDerivatives[2] << ";" << endl; - else - output << "M_.NNZDerivatives(3) = -1;" << endl; - } + output << NNZDerivatives[1] << "; "; else - output << "M_.NNZDerivatives(2) = -1;" << endl - << "M_.NNZDerivatives(3) = -1;" << endl; + output << "-1; "; + if (order > 2) + output << NNZDerivatives[2]; + else + output << "-1"; + output << "];" << endl; } map >, expr_t>