Skip to content
Snippets Groups Projects
Commit df0db38b authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Bugfix: M_.sigma_e_is_diagonal could be wrong if there were several shocks blocks.

parent 755b5725
No related branches found
No related tags found
No related merge requests found
...@@ -594,6 +594,9 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, b ...@@ -594,6 +594,9 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, b
mOutputFile << "M_.H = 0;" << endl mOutputFile << "M_.H = 0;" << endl
<< "M_.Correlation_matrix_ME = 1;" << endl; << "M_.Correlation_matrix_ME = 1;" << endl;
// May be later modified by a shocks block
mOutputFile << "M_.sigma_e_is_diagonal = 1;" << endl;
// Initialize M_.det_shocks // Initialize M_.det_shocks
mOutputFile << "M_.det_shocks = [];" << endl; mOutputFile << "M_.det_shocks = [];" << endl;
......
...@@ -89,9 +89,14 @@ ShocksStatement::writeOutput(ostream &output, const string &basename) const ...@@ -89,9 +89,14 @@ ShocksStatement::writeOutput(ostream &output, const string &basename) const
writeDetShocks(output); writeDetShocks(output);
writeVarAndStdShocks(output); writeVarAndStdShocks(output);
writeCovarAndCorrShocks(output); writeCovarAndCorrShocks(output);
/* M_.sigma_e_is_diagonal is initialized to 1 by ModFile.cc.
If there are no off-diagonal elements, and we are not in overwrite mode,
then we don't reset it to 1, since there might be previous shocks blocks
with off-diagonal elements. */
if (covar_shocks.size()+corr_shocks.size() > 0) if (covar_shocks.size()+corr_shocks.size() > 0)
output << "M_.sigma_e_is_diagonal = 0;" << endl; output << "M_.sigma_e_is_diagonal = 0;" << endl;
else else if (overwrite)
output << "M_.sigma_e_is_diagonal = 1;" << endl; output << "M_.sigma_e_is_diagonal = 1;" << endl;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment