Skip to content
Snippets Groups Projects
Commit 47c22072 authored by sebastien's avatar sebastien
Browse files

v4 matlab+preprocessor: the three homotopy modes should now work

git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1769 ac1d8469-bf42-47a9-8791-bf33cf982152
parent 95d21181
No related branches found
No related tags found
No related merge requests found
...@@ -163,11 +163,10 @@ HomotopyStatement::HomotopyStatement(const homotopy_values_type &homotopy_values ...@@ -163,11 +163,10 @@ HomotopyStatement::HomotopyStatement(const homotopy_values_type &homotopy_values
void void
HomotopyStatement::writeOutput(ostream &output, const string &basename) const HomotopyStatement::writeOutput(ostream &output, const string &basename) const
{ {
output << interfaces::comment() << "\n" << interfaces::comment() << "HOMOTOPY_SETUP instructions\n" output << interfaces::comment() << endl
<< interfaces::comment() << "\n"; << interfaces::comment() << "HOMOTOPY_SETUP instructions" << endl
output << "homotopy_param = {};" << endl; << interfaces::comment() << endl
output << "homotopy_exo = {};" << endl; << "options_.homotopy_values = [];" << endl;
output << "homotopy_exodet = {};" << endl;
for(homotopy_values_type::const_iterator it = homotopy_values.begin(); for(homotopy_values_type::const_iterator it = homotopy_values.begin();
it != homotopy_values.end(); it++) it != homotopy_values.end(); it++)
...@@ -176,24 +175,13 @@ HomotopyStatement::writeOutput(ostream &output, const string &basename) const ...@@ -176,24 +175,13 @@ HomotopyStatement::writeOutput(ostream &output, const string &basename) const
const NodeID expression1 = it->second.first; const NodeID expression1 = it->second.first;
const NodeID expression2 = it->second.second; const NodeID expression2 = it->second.second;
Type type = symbol_table.getType(name); const Type type = symbol_table.getType(name);
const int id = symbol_table.getID(name) + 1;
if (type == eParameter)
output << "homotopy_param = vertcat(homotopy_param,{ '" << name << "', ";
else if (type == eExogenous)
output << "homotopy_exo = vertcat(homotopy_exo,{ '" << name << "', ";
else if (type != eExogenousDet)
output << "homotopy_exodet = vertcat(homotopy_exodet,{ '" << name << "', ";
output << "options_.homotopy_values = vertcat(options_.homotopy_values, [ " << type << ", " << id << ", ";
expression1->writeOutput(output); expression1->writeOutput(output);
output << ", "; output << ", ";
expression2->writeOutput(output); expression2->writeOutput(output);
output << "});" << endl; output << "]);" << endl;
} }
output << "options_.homotopy_param = homotopy_param;" << endl;
output << "options_.homotopy_exo = homotopy_exo;" << endl;
output << "options_.homotopy_exodet = homotopy_exodet;" << endl;
} }
...@@ -350,8 +350,7 @@ ParsingDriver::homotopy_val(string *name, NodeID val1, NodeID val2) ...@@ -350,8 +350,7 @@ ParsingDriver::homotopy_val(string *name, NodeID val1, NodeID val2)
if (homotopy_values.find(*name) != homotopy_values.end()) if (homotopy_values.find(*name) != homotopy_values.end())
error("homotopy_val: " + *name +" declared twice"); error("homotopy_val: " + *name +" declared twice");
pair<NodeID, NodeID> expressions(val1, val2); homotopy_values[*name] = make_pair(val1, val2);
homotopy_values[*name] = expressions;
delete name; delete name;
} }
......
...@@ -58,7 +58,7 @@ const int EVALUATE_FOREWARD_R=8; ...@@ -58,7 +58,7 @@ const int EVALUATE_FOREWARD_R=8;
const int EVALUATE_BACKWARD_R=9; const int EVALUATE_BACKWARD_R=9;
//! Enumeration of possible symbol types //! Enumeration of possible symbol types
/*! Warning: do not to change the order of the enumeration, it matters for VariableTable (at least ensure that eEndogenous is the first one) */ /*! Warning: do not to change existing values: the order matters for VariableTable (at least ensure that eEndogenous is the first one), and the values matter for homotopy_setup command */
enum Type enum Type
{ {
eEndogenous = 0, //!< Endogenous eEndogenous = 0, //!< Endogenous
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment