Multiple "shocks" block are cumulative.

This was the default behavior before commit 82b31156. This commit reintroduces
this behavior.
issue#70
Sébastien Villemot 2014-04-09 15:23:20 +02:00
parent e040e4d0d6
commit ff17a871dd
2 changed files with 10 additions and 13 deletions

View File

@ -585,6 +585,9 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, b
<< "M_.Correlation_matrix = eye(" << symbol_table.exo_nbr() << ", "
<< symbol_table.exo_nbr() << ");" << endl;
// Initialize M_.det_shocks
mOutputFile << "M_.det_shocks = [];" << endl;
if (mod_file_struct.calibrated_measurement_errors)
mOutputFile << "M_.H = zeros(" << symbol_table.observedVariablesNbr() << ", "
<< symbol_table.observedVariablesNbr() << ");" << endl

View File

@ -36,7 +36,6 @@ void
AbstractShocksStatement::writeDetShocks(ostream &output) const
{
int exo_det_length = 0;
int counter = 1;
for (det_shocks_t::const_iterator it = det_shocks.begin();
it != det_shocks.end(); it++)
@ -50,19 +49,14 @@ AbstractShocksStatement::writeDetShocks(ostream &output) const
const int &period2 = it->second[i].period2;
const expr_t value = it->second[i].value;
output << "M_.det_shocks(" << counter << ").exo_det=" << (int) exo_det
<< ";" << endl
<< "M_.det_shocks(" << counter << ").exo_id=" << id
<< ";" << endl
<< "M_.det_shocks(" << counter << ").multiplicative=" << (int) mshocks
<< ";" << endl
<< "M_.det_shocks(" << counter << ").periods=" << period1
<< ":" << period2 << ";" << endl
<< "M_.det_shocks(" << counter << ").value=(";
output << "M_.det_shocks = [ M_.det_shocks;" << endl
<< "struct('exo_det'," << (int) exo_det
<< ",'exo_id'," << id
<< ",'multiplicative'," << (int) mshocks
<< ",'periods'," << period1 << ":" << period2
<< ",'value',";
value->writeOutput(output);
output << ");" << endl;
counter++;
output << ") ];" << endl;
if (exo_det && (period2 > exo_det_length))
exo_det_length = period2;