fix writing of aux vars, predetermined vars, and observed vars

issue#70
Houtan Bastani 2015-07-29 11:51:27 +02:00
parent 601a52a093
commit ace7278623
1 changed files with 47 additions and 37 deletions

View File

@ -771,53 +771,63 @@ SymbolTable::writeJuliaOutput(ostream &output) const throw (NotYetFrozenExceptio
output << "model.orig_endo_nbr = " << orig_endo_nbr() << endl; output << "model.orig_endo_nbr = " << orig_endo_nbr() << endl;
if (aux_vars.size() > 0) if (aux_vars.size() > 0)
for (int i = 0; i < (int) aux_vars.size(); i++) {
{ output << "# Auxiliary Variables" << endl
output << "push!(model.aux_vars, " << "model.aux_vars = [" << endl;
<< getTypeSpecificID(aux_vars[i].get_symb_id()) + 1 << ", " for (int i = 0; i < (int) aux_vars.size(); i++)
<< aux_vars[i].get_type() << ", "; {
switch (aux_vars[i].get_type()) output << " DynareModel.AuxVars("
{ << getTypeSpecificID(aux_vars[i].get_symb_id()) + 1 << ", "
case avEndoLead: << aux_vars[i].get_type() << ", ";
case avExoLead: switch (aux_vars[i].get_type())
break; {
case avEndoLag: case avEndoLead:
case avExoLag: case avExoLead:
output << getTypeSpecificID(aux_vars[i].get_orig_symb_id()) + 1 << ", " break;
<< aux_vars[i].get_orig_lead_lag() << ", "; case avEndoLag:
break; case avExoLag:
case avMultiplier: output << getTypeSpecificID(aux_vars[i].get_orig_symb_id()) + 1 << ", "
output << "NaN, NaN, " << aux_vars[i].get_equation_number_for_multiplier() + 1 << ", " << endl; << aux_vars[i].get_orig_lead_lag() << ", NaN, NaN";
break; break;
case avDiffForward: case avMultiplier:
output << getTypeSpecificID(aux_vars[i].get_orig_symb_id())+1 << ", NaN, "; output << "NaN, NaN, " << aux_vars[i].get_equation_number_for_multiplier() + 1
break; << ", NaN";
case avExpectation: break;
output << "NaN, NaN, NaN, \"\\mathbb{E}_{t" case avDiffForward:
<< (aux_vars[i].get_information_set() < 0 ? "" : "+") output << getTypeSpecificID(aux_vars[i].get_orig_symb_id())+1 << ", NaN, ";
<< aux_vars[i].get_information_set() << "}("; break;
aux_vars[i].get_expectation_expr_node()->writeOutput(output, oLatexDynamicModel); case avExpectation:
output << ")\"" << endl; output << "NaN, NaN, NaN, \"\\mathbb{E}_{t"
break; << (aux_vars[i].get_information_set() < 0 ? "" : "+")
} << aux_vars[i].get_information_set() << "}(";
} aux_vars[i].get_expectation_expr_node()->writeOutput(output, oLatexDynamicModel);
output << ")\"";
break;
}
output << ")" << endl;
}
output << "]" << endl;
}
if (predeterminedNbr() > 0) if (predeterminedNbr() > 0)
{ {
output << "model.pred_vars = [ "; output << "# Predetermined Variables" << endl
<< "model.pred_vars = [ " << endl;
for (set<int>::const_iterator it = predetermined_variables.begin(); for (set<int>::const_iterator it = predetermined_variables.begin();
it != predetermined_variables.end(); it++) it != predetermined_variables.end(); it++)
output << getTypeSpecificID(*it)+1 << "; "; output << " DynareModel.PredVars("
output << "];" << endl; << getTypeSpecificID(*it)+1 << ")" << endl;
output << " ]" << endl;
} }
if (observedVariablesNbr() > 0) if (observedVariablesNbr() > 0)
{ {
output << "options_.obs_vars = [ "; output << "# Observed Variables" << endl
<< "options.obs_vars = [" << endl;
for (vector<int>::const_iterator it = varobs.begin(); for (vector<int>::const_iterator it = varobs.begin();
it != varobs.end(); it++) it != varobs.end(); it++)
output << getTypeSpecificID(*it)+1 << "; "; output << " DynareModel.ObsVars("
output << " ];" << endl; << getTypeSpecificID(*it)+1 << ")" << endl;
output << " ]" << endl;
} }
} }