preprocessor: move M_.Correlation_matrix and M_.Correlation_matrix_ME to preprocessor #392
parent
4852c12099
commit
bd9e8acdab
|
@ -537,15 +537,20 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, b
|
||||||
|
|
||||||
symbol_table.writeOutput(mOutputFile);
|
symbol_table.writeOutput(mOutputFile);
|
||||||
|
|
||||||
// Initialize M_.Sigma_e and M_.H
|
// Initialize M_.Sigma_e, M_.Correlation_matrix, M_.H, and M_.Correlation_matrix_ME
|
||||||
mOutputFile << "M_.Sigma_e = zeros(" << symbol_table.exo_nbr() << ", "
|
mOutputFile << "M_.Sigma_e = zeros(" << symbol_table.exo_nbr() << ", "
|
||||||
|
<< symbol_table.exo_nbr() << ");" << endl
|
||||||
|
<< "M_.Correlation_matrix = eye(" << symbol_table.exo_nbr() << ", "
|
||||||
<< symbol_table.exo_nbr() << ");" << endl;
|
<< symbol_table.exo_nbr() << ");" << endl;
|
||||||
|
|
||||||
if (mod_file_struct.calibrated_measurement_errors)
|
if (mod_file_struct.calibrated_measurement_errors)
|
||||||
mOutputFile << "M_.H = zeros(" << symbol_table.observedVariablesNbr() << ", "
|
mOutputFile << "M_.H = zeros(" << symbol_table.observedVariablesNbr() << ", "
|
||||||
|
<< symbol_table.observedVariablesNbr() << ");" << endl
|
||||||
|
<< "M_.Correlation_matrix_ME = eye(" << symbol_table.observedVariablesNbr() << ", "
|
||||||
<< symbol_table.observedVariablesNbr() << ");" << endl;
|
<< symbol_table.observedVariablesNbr() << ");" << endl;
|
||||||
else
|
else
|
||||||
mOutputFile << "M_.H = 0;" << endl;
|
mOutputFile << "M_.H = 0;" << endl
|
||||||
|
<< "M_.Correlation_matrix_ME = 1;" << endl;
|
||||||
|
|
||||||
if (linear == 1)
|
if (linear == 1)
|
||||||
mOutputFile << "options_.linear = 1;" << endl;
|
mOutputFile << "options_.linear = 1;" << endl;
|
||||||
|
|
13
Shocks.cc
13
Shocks.cc
|
@ -155,17 +155,19 @@ ShocksStatement::writeCovarOrCorrShock(ostream &output, covar_and_corr_shocks_t:
|
||||||
SymbolType type2 = symbol_table.getType(it->first.second);
|
SymbolType type2 = symbol_table.getType(it->first.second);
|
||||||
assert((type1 == eExogenous && type2 == eExogenous)
|
assert((type1 == eExogenous && type2 == eExogenous)
|
||||||
|| (symbol_table.isObservedVariable(it->first.first) && symbol_table.isObservedVariable(it->first.second)));
|
|| (symbol_table.isObservedVariable(it->first.first) && symbol_table.isObservedVariable(it->first.second)));
|
||||||
string matrix;
|
string matrix, corr_matrix;
|
||||||
int id1, id2;
|
int id1, id2;
|
||||||
if (type1 == eExogenous)
|
if (type1 == eExogenous)
|
||||||
{
|
{
|
||||||
matrix = "M_.Sigma_e";
|
matrix = "M_.Sigma_e";
|
||||||
|
corr_matrix = "M_.Correlation_matrix";
|
||||||
id1 = symbol_table.getTypeSpecificID(it->first.first) + 1;
|
id1 = symbol_table.getTypeSpecificID(it->first.first) + 1;
|
||||||
id2 = symbol_table.getTypeSpecificID(it->first.second) + 1;
|
id2 = symbol_table.getTypeSpecificID(it->first.second) + 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
matrix = "M_.H";
|
matrix = "M_.H";
|
||||||
|
corr_matrix = "M_.Correlation_matrix_ME";
|
||||||
id1 = symbol_table.getObservedVariableIndex(it->first.first) + 1;
|
id1 = symbol_table.getObservedVariableIndex(it->first.first) + 1;
|
||||||
id2 = symbol_table.getObservedVariableIndex(it->first.second) + 1;
|
id2 = symbol_table.getObservedVariableIndex(it->first.second) + 1;
|
||||||
}
|
}
|
||||||
|
@ -178,6 +180,15 @@ ShocksStatement::writeCovarOrCorrShock(ostream &output, covar_and_corr_shocks_t:
|
||||||
output << ";" << endl
|
output << ";" << endl
|
||||||
<< matrix << "(" << id2 << ", " << id1 << ") = "
|
<< matrix << "(" << id2 << ", " << id1 << ") = "
|
||||||
<< matrix << "(" << id1 << ", " << id2 << ");" << endl;
|
<< matrix << "(" << id1 << ", " << id2 << ");" << endl;
|
||||||
|
|
||||||
|
if (corr)
|
||||||
|
{
|
||||||
|
output << corr_matrix << "(" << id1 << ", " << id2 << ") = ";
|
||||||
|
it->second->writeOutput(output);
|
||||||
|
output << ";" << endl
|
||||||
|
<< corr_matrix << "(" << id2 << ", " << id1 << ") = "
|
||||||
|
<< corr_matrix << "(" << id1 << ", " << id2 << ");" << endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue