Commit 3aa88765 authored by sebastien's avatar sebastien

Beautified preprocessor code (uncrustify + emacs + manual adjustments, in...

Beautified preprocessor code (uncrustify + emacs + manual adjustments, in particular with templates in MacroValue)

git-svn-id: https://www.dynare.org/svn/dynare/trunk@3249 ac1d8469-bf42-47a9-8791-bf33cf982152
parent 160ec5d7
This diff is collapsed.
...@@ -67,18 +67,19 @@ ModelInfoStatement::ModelInfoStatement(const OptionsList &options_list_arg) : ...@@ -67,18 +67,19 @@ ModelInfoStatement::ModelInfoStatement(const OptionsList &options_list_arg) :
{ {
} }
void ModelInfoStatement::checkPass(ModFileStructure &mod_file_struct) void
ModelInfoStatement::checkPass(ModFileStructure &mod_file_struct)
{ {
//mod_file_struct.model_info_present = true; //mod_file_struct.model_info_present = true;
} }
void ModelInfoStatement::writeOutput(ostream &output, const string &basename) const void
ModelInfoStatement::writeOutput(ostream &output, const string &basename) const
{ {
options_list.writeOutput(output); options_list.writeOutput(output);
output << "model_info();\n"; output << "model_info();\n";
} }
SimulStatement::SimulStatement(const OptionsList &options_list_arg) : SimulStatement::SimulStatement(const OptionsList &options_list_arg) :
options_list(options_list_arg) options_list(options_list_arg)
{ {
...@@ -112,7 +113,7 @@ StochSimulStatement::checkPass(ModFileStructure &mod_file_struct) ...@@ -112,7 +113,7 @@ StochSimulStatement::checkPass(ModFileStructure &mod_file_struct)
// Fill in option_order of mod_file_struct // Fill in option_order of mod_file_struct
OptionsList::num_options_type::const_iterator it = options_list.num_options.find("order"); OptionsList::num_options_type::const_iterator it = options_list.num_options.find("order");
if (it != options_list.num_options.end()) if (it != options_list.num_options.end())
mod_file_struct.order_option = max(mod_file_struct.order_option,atoi(it->second.c_str())); mod_file_struct.order_option = max(mod_file_struct.order_option, atoi(it->second.c_str()));
// Fill in mod_file_struct.partial_information // Fill in mod_file_struct.partial_information
it = options_list.num_options.find("partial_information"); it = options_list.num_options.find("partial_information");
...@@ -211,7 +212,7 @@ EstimationStatement::checkPass(ModFileStructure &mod_file_struct) ...@@ -211,7 +212,7 @@ EstimationStatement::checkPass(ModFileStructure &mod_file_struct)
// Fill in option_order of mod_file_struct // Fill in option_order of mod_file_struct
OptionsList::num_options_type::const_iterator it = options_list.num_options.find("order"); OptionsList::num_options_type::const_iterator it = options_list.num_options.find("order");
if (it != options_list.num_options.end()) if (it != options_list.num_options.end())
mod_file_struct.order_option = max(mod_file_struct.order_option,atoi(it->second.c_str())); mod_file_struct.order_option = max(mod_file_struct.order_option, atoi(it->second.c_str()));
// Fill in mod_file_struct.partial_information // Fill in mod_file_struct.partial_information
it = options_list.num_options.find("partial_information"); it = options_list.num_options.find("partial_information");
...@@ -274,7 +275,7 @@ DynareSensitivityStatement::checkPass(ModFileStructure &mod_file_struct) ...@@ -274,7 +275,7 @@ DynareSensitivityStatement::checkPass(ModFileStructure &mod_file_struct)
void void
DynareSensitivityStatement::writeOutput(ostream &output, const string &basename) const DynareSensitivityStatement::writeOutput(ostream &output, const string &basename) const
{ {
options_list.writeOutput(output,"options_gsa"); options_list.writeOutput(output, "options_gsa");
output << "dynare_sensitivity(options_gsa);" << endl; output << "dynare_sensitivity(options_gsa);" << endl;
} }
...@@ -362,12 +363,12 @@ EstimatedParamsStatement::writeOutput(ostream &output, const string &basename) c ...@@ -362,12 +363,12 @@ EstimatedParamsStatement::writeOutput(ostream &output, const string &basename) c
vector<EstimationParams>::const_iterator it; vector<EstimationParams>::const_iterator it;
for(it = estim_params_list.begin(); it != estim_params_list.end(); it++) for (it = estim_params_list.begin(); it != estim_params_list.end(); it++)
{ {
int symb_id = symbol_table.getTypeSpecificID(it->name) + 1; int symb_id = symbol_table.getTypeSpecificID(it->name) + 1;
SymbolType symb_type = symbol_table.getType(it->name); SymbolType symb_type = symbol_table.getType(it->name);
switch(it->type) switch (it->type)
{ {
case 1: case 1:
if (symb_type == eExogenous) if (symb_type == eExogenous)
...@@ -421,7 +422,7 @@ EstimatedParamsInitStatement::writeOutput(ostream &output, const string &basenam ...@@ -421,7 +422,7 @@ EstimatedParamsInitStatement::writeOutput(ostream &output, const string &basenam
{ {
vector<EstimationParams>::const_iterator it; vector<EstimationParams>::const_iterator it;
for(it = estim_params_list.begin(); it != estim_params_list.end(); it++) for (it = estim_params_list.begin(); it != estim_params_list.end(); it++)
{ {
int symb_id = symbol_table.getTypeSpecificID(it->name) + 1; int symb_id = symbol_table.getTypeSpecificID(it->name) + 1;
SymbolType symb_type = symbol_table.getType(it->name); SymbolType symb_type = symbol_table.getType(it->name);
...@@ -482,7 +483,7 @@ EstimatedParamsBoundsStatement::writeOutput(ostream &output, const string &basen ...@@ -482,7 +483,7 @@ EstimatedParamsBoundsStatement::writeOutput(ostream &output, const string &basen
{ {
vector<EstimationParams>::const_iterator it; vector<EstimationParams>::const_iterator it;
for(it = estim_params_list.begin(); it != estim_params_list.end(); it++) for (it = estim_params_list.begin(); it != estim_params_list.end(); it++)
{ {
int symb_id = symbol_table.getTypeSpecificID(it->name) + 1; int symb_id = symbol_table.getTypeSpecificID(it->name) + 1;
SymbolType symb_type = symbol_table.getType(it->name); SymbolType symb_type = symbol_table.getType(it->name);
...@@ -570,7 +571,7 @@ ObservationTrendsStatement::writeOutput(ostream &output, const string &basename) ...@@ -570,7 +571,7 @@ ObservationTrendsStatement::writeOutput(ostream &output, const string &basename)
trend_elements_type::const_iterator it; trend_elements_type::const_iterator it;
for(it = trend_elements.begin(); it != trend_elements.end(); it++) for (it = trend_elements.begin(); it != trend_elements.end(); it++)
{ {
SymbolType type = symbol_table.getType(it->first); SymbolType type = symbol_table.getType(it->first);
if (type == eEndogenous) if (type == eEndogenous)
...@@ -604,7 +605,7 @@ CalibVarStatement::writeOutput(ostream &output, const string &basename) const ...@@ -604,7 +605,7 @@ CalibVarStatement::writeOutput(ostream &output, const string &basename) const
<< "% CALIB_VAR" << endl << "% CALIB_VAR" << endl
<< "%" << endl; << "%" << endl;
for(int i = 1; i < 4 ; i++) for (int i = 1; i < 4; i++)
{ {
output << "calib_var_index{" << i << "} = [];\n"; output << "calib_var_index{" << i << "} = [];\n";
output << "calib_targets{" << i << "} = [];\n"; output << "calib_targets{" << i << "} = [];\n";
...@@ -612,8 +613,8 @@ CalibVarStatement::writeOutput(ostream &output, const string &basename) const ...@@ -612,8 +613,8 @@ CalibVarStatement::writeOutput(ostream &output, const string &basename) const
} }
// Print calibration variances // Print calibration variances
for(calib_var_type::const_iterator it = calib_var.begin(); for (calib_var_type::const_iterator it = calib_var.begin();
it != calib_var.end(); it++) it != calib_var.end(); it++)
{ {
const string &name = it->first; const string &name = it->first;
const string &weight = it->second.first; const string &weight = it->second.first;
...@@ -639,8 +640,8 @@ CalibVarStatement::writeOutput(ostream &output, const string &basename) const ...@@ -639,8 +640,8 @@ CalibVarStatement::writeOutput(ostream &output, const string &basename) const
} }
// Print calibration covariances // Print calibration covariances
for(calib_covar_type::const_iterator it = calib_covar.begin(); for (calib_covar_type::const_iterator it = calib_covar.begin();
it != calib_covar.end(); it++) it != calib_covar.end(); it++)
{ {
const string &name1 = it->first.first; const string &name1 = it->first.first;
const string &name2 = it->first.second; const string &name2 = it->first.second;
...@@ -670,8 +671,8 @@ CalibVarStatement::writeOutput(ostream &output, const string &basename) const ...@@ -670,8 +671,8 @@ CalibVarStatement::writeOutput(ostream &output, const string &basename) const
// Print calibration autocorrelations // Print calibration autocorrelations
int max_iar = 3; int max_iar = 3;
for(calib_ac_type::const_iterator it = calib_ac.begin(); for (calib_ac_type::const_iterator it = calib_ac.begin();
it != calib_ac.end(); it++) it != calib_ac.end(); it++)
{ {
const string &name = it->first.first; const string &name = it->first.first;
int iar = it->first.second + 3; int iar = it->first.second + 3;
...@@ -683,7 +684,7 @@ CalibVarStatement::writeOutput(ostream &output, const string &basename) const ...@@ -683,7 +684,7 @@ CalibVarStatement::writeOutput(ostream &output, const string &basename) const
if (iar > max_iar) if (iar > max_iar)
{ {
// Create new variables // Create new variables
for(int i = max_iar + 1; i <= iar; i++) for (int i = max_iar + 1; i <= iar; i++)
{ {
output << "calib_var_index{" << i << "} = [];\n"; output << "calib_var_index{" << i << "} = [];\n";
output << "calib_targets{" << i << "} = [];\n"; output << "calib_targets{" << i << "} = [];\n";
...@@ -736,7 +737,7 @@ OsrStatement::checkPass(ModFileStructure &mod_file_struct) ...@@ -736,7 +737,7 @@ OsrStatement::checkPass(ModFileStructure &mod_file_struct)
// Fill in option_order of mod_file_struct // Fill in option_order of mod_file_struct
OptionsList::num_options_type::const_iterator it = options_list.num_options.find("order"); OptionsList::num_options_type::const_iterator it = options_list.num_options.find("order");
if (it != options_list.num_options.end()) if (it != options_list.num_options.end())
mod_file_struct.order_option = max(mod_file_struct.order_option,atoi(it->second.c_str())); mod_file_struct.order_option = max(mod_file_struct.order_option, atoi(it->second.c_str()));
// Fill in mod_file_struct.partial_information // Fill in mod_file_struct.partial_information
it = options_list.num_options.find("partial_information"); it = options_list.num_options.find("partial_information");
...@@ -776,8 +777,8 @@ OptimWeightsStatement::writeOutput(ostream &output, const string &basename) cons ...@@ -776,8 +777,8 @@ OptimWeightsStatement::writeOutput(ostream &output, const string &basename) cons
<< "optim_weights_ = sparse(M_.endo_nbr,M_.endo_nbr);" << endl << "optim_weights_ = sparse(M_.endo_nbr,M_.endo_nbr);" << endl
<< "obj_var_ = [];" << endl << endl; << "obj_var_ = [];" << endl << endl;
for(var_weights_type::const_iterator it = var_weights.begin(); for (var_weights_type::const_iterator it = var_weights.begin();
it != var_weights.end(); it++) it != var_weights.end(); it++)
{ {
const string &name = it->first; const string &name = it->first;
const NodeID value = it->second; const NodeID value = it->second;
...@@ -788,8 +789,8 @@ OptimWeightsStatement::writeOutput(ostream &output, const string &basename) cons ...@@ -788,8 +789,8 @@ OptimWeightsStatement::writeOutput(ostream &output, const string &basename) cons
output << "obj_var_ = [obj_var_; " << id << "];\n"; output << "obj_var_ = [obj_var_; " << id << "];\n";
} }
for(covar_weights_type::const_iterator it = covar_weights.begin(); for (covar_weights_type::const_iterator it = covar_weights.begin();
it != covar_weights.end(); it++) it != covar_weights.end(); it++)
{ {
const string &name1 = it->first.first; const string &name1 = it->first.first;
const string &name2 = it->first.second; const string &name2 = it->first.second;
...@@ -848,8 +849,8 @@ ModelComparisonStatement::writeOutput(ostream &output, const string &basename) c ...@@ -848,8 +849,8 @@ ModelComparisonStatement::writeOutput(ostream &output, const string &basename) c
output << "ModelNames_ = {};" << endl; output << "ModelNames_ = {};" << endl;
output << "ModelPriors_ = [];" << endl; output << "ModelPriors_ = [];" << endl;
for(filename_list_type::const_iterator it = filename_list.begin(); for (filename_list_type::const_iterator it = filename_list.begin();
it != filename_list.end(); it++) it != filename_list.end(); it++)
{ {
output << "ModelNames_ = { ModelNames_{:} '" << (*it).first << "'};" << endl; output << "ModelNames_ = { ModelNames_{:} '" << (*it).first << "'};" << endl;
output << "ModelPriors_ = [ ModelPriors_ ; " << (*it).second << "];" << endl; output << "ModelPriors_ = [ ModelPriors_ ; " << (*it).second << "];" << endl;
...@@ -959,8 +960,6 @@ MS_SBVARStatement::writeOutput(ostream &output, const string &basename) const ...@@ -959,8 +960,6 @@ MS_SBVARStatement::writeOutput(ostream &output, const string &basename) const
output << "swz_sbvar(1,M_,options_);" << endl; output << "swz_sbvar(1,M_,options_);" << endl;
} }
IdentificationStatement::IdentificationStatement(const OptionsList &options_list_arg) : IdentificationStatement::IdentificationStatement(const OptionsList &options_list_arg) :
options_list(options_list_arg) options_list(options_list_arg)
{ {
...@@ -1002,7 +1001,7 @@ WriteLatexStaticModelStatement::writeOutput(ostream &output, const string &basen ...@@ -1002,7 +1001,7 @@ WriteLatexStaticModelStatement::writeOutput(ostream &output, const string &basen
} }
ShockDecompositionStatement::ShockDecompositionStatement(const SymbolList &symbol_list_arg, ShockDecompositionStatement::ShockDecompositionStatement(const SymbolList &symbol_list_arg,
const OptionsList &options_list_arg) : const OptionsList &options_list_arg) :
symbol_list(symbol_list_arg), symbol_list(symbol_list_arg),
options_list(options_list_arg) options_list(options_list_arg)
{ {
...@@ -1104,7 +1103,7 @@ SvarIdentificationStatement::writeOutput(ostream &output, const string &basename ...@@ -1104,7 +1103,7 @@ SvarIdentificationStatement::writeOutput(ostream &output, const string &basename
int r = getMaxLag(); int r = getMaxLag();
int k = r*n+m; int k = r*n+m;
if (k<1) if (k < 1)
{ {
cerr << "ERROR: lag = " << r cerr << "ERROR: lag = " << r
<< ", number of endogenous variables = " << n << ", number of endogenous variables = " << n
...@@ -1113,7 +1112,7 @@ SvarIdentificationStatement::writeOutput(ostream &output, const string &basename ...@@ -1113,7 +1112,7 @@ SvarIdentificationStatement::writeOutput(ostream &output, const string &basename
<< " of the .mod file, please report it to the Dynare Team." << endl; << " of the .mod file, please report it to the Dynare Team." << endl;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (n<1) if (n < 1)
{ {
cerr << "ERROR: Number of endogenous variables = " << n << "< 1. If this is not a logical " cerr << "ERROR: Number of endogenous variables = " << n << "< 1. If this is not a logical "
<< "error in the specification of the .mod file, please report it to the Dynare Team." << endl; << "error in the specification of the .mod file, please report it to the Dynare Team." << endl;
...@@ -1128,7 +1127,7 @@ SvarIdentificationStatement::writeOutput(ostream &output, const string &basename ...@@ -1128,7 +1127,7 @@ SvarIdentificationStatement::writeOutput(ostream &output, const string &basename
{ {
int j = it->second.at(h) + 1; int j = it->second.at(h) + 1;
int i = it->first.second; int i = it->first.second;
if (j < 1 || j > n || (int)h+1 > n || i < 1) if (j < 1 || j > n || (int) h+1 > n || i < 1)
{ {
cerr << "SvarIdentificationStatement::writeOutput() Should not arrive here (2). Please report this to the Dynare Team." << endl; cerr << "SvarIdentificationStatement::writeOutput() Should not arrive here (2). Please report this to the Dynare Team." << endl;
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
...@@ -1186,12 +1185,12 @@ MarkovSwitchingStatement::writeOutput(ostream &output, const string &basename) c ...@@ -1186,12 +1185,12 @@ MarkovSwitchingStatement::writeOutput(ostream &output, const string &basename) c
itState = options_list.num_options.find("ms.state"); itState = options_list.num_options.find("ms.state");
itNOS = options_list.num_options.find("ms.number_of_states"); itNOS = options_list.num_options.find("ms.number_of_states");
if (itState != options_list.num_options.end() && if (itState != options_list.num_options.end()
itNOS == options_list.num_options.end()) && itNOS == options_list.num_options.end())
output << "options_.ms.ms_chain(" << itChain->second << ").state(" << itState->second << ").duration = " << itDuration->second << ";" << endl; output << "options_.ms.ms_chain(" << itChain->second << ").state(" << itState->second << ").duration = " << itDuration->second << ";" << endl;
else if (itState == options_list.num_options.end() && else if (itState == options_list.num_options.end()
itNOS != options_list.num_options.end()) && itNOS != options_list.num_options.end())
for (int i=0; i<atoi(itNOS->second.c_str()); i++) for (int i = 0; i < atoi(itNOS->second.c_str()); i++)
output << "options_.ms.ms_chain(" << itChain->second << ").state(" << i+1 << ").duration = " << itDuration->second << ";" << endl; output << "options_.ms.ms_chain(" << itChain->second << ").state(" << i+1 << ").duration = " << itDuration->second << ";" << endl;
else else
{ {
...@@ -1200,7 +1199,6 @@ MarkovSwitchingStatement::writeOutput(ostream &output, const string &basename) c ...@@ -1200,7 +1199,6 @@ MarkovSwitchingStatement::writeOutput(ostream &output, const string &basename) c
} }
} }
SvarStatement::SvarStatement(const OptionsList &options_list_arg) : SvarStatement::SvarStatement(const OptionsList &options_list_arg) :
options_list(options_list_arg) options_list(options_list_arg)
{ {
...@@ -1224,17 +1222,17 @@ SvarStatement::writeOutput(ostream &output, const string &basename) const ...@@ -1224,17 +1222,17 @@ SvarStatement::writeOutput(ostream &output, const string &basename) const
it0 = options_list.string_options.find("ms.coefficients"); it0 = options_list.string_options.find("ms.coefficients");
it1 = options_list.string_options.find("ms.variances"); it1 = options_list.string_options.find("ms.variances");
it2 = options_list.string_options.find("ms.constants"); it2 = options_list.string_options.find("ms.constants");
if (it0 != options_list.string_options.end() && if (it0 != options_list.string_options.end()
it1 == options_list.string_options.end() && && it1 == options_list.string_options.end()
it2 == options_list.string_options.end()) && it2 == options_list.string_options.end())
output << "." << it0->second; output << "." << it0->second;
else if (it0 == options_list.string_options.end() && else if (it0 == options_list.string_options.end()
it1 != options_list.string_options.end() && && it1 != options_list.string_options.end()
it2 == options_list.string_options.end()) && it2 == options_list.string_options.end())
output << "." << it1->second; output << "." << it1->second;
else if (it0 == options_list.string_options.end() && else if (it0 == options_list.string_options.end()
it1 == options_list.string_options.end() && && it1 == options_list.string_options.end()
it2 != options_list.string_options.end()) && it2 != options_list.string_options.end())
output << "." << it2->second; output << "." << it2->second;
else else
{ {
...@@ -1249,8 +1247,8 @@ SvarStatement::writeOutput(ostream &output, const string &basename) const ...@@ -1249,8 +1247,8 @@ SvarStatement::writeOutput(ostream &output, const string &basename) const
if (itv->second.size() > 1) if (itv->second.size() > 1)
{ {
output << "["; output << "[";
for (vector<int>::const_iterator viit=itv->second.begin(); for (vector<int>::const_iterator viit = itv->second.begin();
viit!=itv->second.end(); viit++) viit != itv->second.end(); viit++)
output << *viit << ";"; output << *viit << ";";
output << "];" << endl; output << "];" << endl;
} }
......
...@@ -272,7 +272,8 @@ public: ...@@ -272,7 +272,8 @@ public:
string name, name2, prior; string name, name2, prior;
NodeID init_val, low_bound, up_bound, mean, std, p3, p4, jscale; NodeID init_val, low_bound, up_bound, mean, std, p3, p4, jscale;
void init(const DataTree &datatree) void
init(const DataTree &datatree)
{ {
type = 0; type = 0;
name = ""; name = "";
...@@ -465,7 +466,7 @@ private: ...@@ -465,7 +466,7 @@ private:
const OptionsList options_list; const OptionsList options_list;
public: public:
ShockDecompositionStatement(const SymbolList &symbol_list_arg, ShockDecompositionStatement(const SymbolList &symbol_list_arg,
const OptionsList &options_list_arg); const OptionsList &options_list_arg);
virtual void writeOutput(ostream &output, const string &basename) const; virtual void writeOutput(ostream &output, const string &basename) const;
}; };
......
...@@ -265,7 +265,8 @@ DataTree::AddLog(NodeID iArg1) ...@@ -265,7 +265,8 @@ DataTree::AddLog(NodeID iArg1)
} }
} }
NodeID DataTree::AddLog10(NodeID iArg1) NodeID
DataTree::AddLog10(NodeID iArg1)
{ {
if (iArg1 != Zero && iArg1 != One) if (iArg1 != Zero && iArg1 != One)
return AddUnaryOp(oLog10, iArg1); return AddUnaryOp(oLog10, iArg1);
...@@ -459,8 +460,8 @@ DataTree::AddUnknownFunction(const string &function_name, const vector<NodeID> & ...@@ -459,8 +460,8 @@ DataTree::AddUnknownFunction(const string &function_name, const vector<NodeID> &
bool bool
DataTree::isSymbolUsed(int symb_id) const DataTree::isSymbolUsed(int symb_id) const
{ {
for(variable_node_map_type::const_iterator it = variable_node_map.begin(); for (variable_node_map_type::const_iterator it = variable_node_map.begin();
it != variable_node_map.end(); it++) it != variable_node_map.end(); it++)
if (it->first.first == symb_id) if (it->first.first == symb_id)
return true; return true;
...@@ -485,8 +486,8 @@ DataTree::getDynJacobianCol(int deriv_id) const throw (UnknownDerivIDException) ...@@ -485,8 +486,8 @@ DataTree::getDynJacobianCol(int deriv_id) const throw (UnknownDerivIDException)
bool bool
DataTree::containsSteadyStateOperator() const DataTree::containsSteadyStateOperator() const
{ {
for(unary_op_node_map_type::const_iterator it = unary_op_node_map.begin(); for (unary_op_node_map_type::const_iterator it = unary_op_node_map.begin();
it != unary_op_node_map.end(); it++) it != unary_op_node_map.end(); it++)
if (it->first.second == oSteadyState) if (it->first.second == oSteadyState)
return true; return true;
......
...@@ -58,7 +58,7 @@ protected: ...@@ -58,7 +58,7 @@ protected:
unary_op_node_map_type unary_op_node_map; unary_op_node_map_type unary_op_node_map;
typedef map<pair<pair<NodeID, NodeID>, BinaryOpcode>, BinaryOpNode *> binary_op_node_map_type; typedef map<pair<pair<NodeID, NodeID>, BinaryOpcode>, BinaryOpNode *> binary_op_node_map_type;
binary_op_node_map_type binary_op_node_map; binary_op_node_map_type binary_op_node_map;
typedef map<pair<pair<pair<NodeID, NodeID>,NodeID>, TrinaryOpcode>, TrinaryOpNode *> trinary_op_node_map_type; typedef map<pair<pair<pair<NodeID, NodeID>, NodeID>, TrinaryOpcode>, TrinaryOpNode *> trinary_op_node_map_type;
trinary_op_node_map_type trinary_op_node_map; trinary_op_node_map_type trinary_op_node_map;
//! Stores local variables value (maps symbol ID to corresponding node) //! Stores local variables value (maps symbol ID to corresponding node)
...@@ -94,7 +94,9 @@ public: ...@@ -94,7 +94,9 @@ public:
{ {
public: public:
string name; string name;
LocalVariableException(const string &name_arg) : name(name_arg) {} LocalVariableException(const string &name_arg) : name(name_arg)
{
}
}; };
//! Adds a numerical constant //! Adds a numerical constant
...@@ -190,7 +192,11 @@ public: ...@@ -190,7 +192,11 @@ public:
virtual int getDynJacobianCol(int deriv_id) const throw (UnknownDerivIDException); virtual int getDynJacobianCol(int deriv_id) const throw (UnknownDerivIDException);
//! Returns bool indicating whether DataTree represents a Dynamic Model (returns true in DynamicModel.hh) //! Returns bool indicating whether DataTree represents a Dynamic Model (returns true in DynamicModel.hh)
virtual bool isDynamic() const { return false; }; virtual bool
isDynamic() const
{
return false;
};
}; };
inline NodeID inline NodeID
...@@ -232,7 +238,7 @@ DataTree::AddUnaryOp(UnaryOpcode op_code, NodeID arg, int arg_exp_info_set) ...@@ -232,7 +238,7 @@ DataTree::AddUnaryOp(UnaryOpcode op_code, NodeID arg, int arg_exp_info_set)
double val = UnaryOpNode::eval_opcode(op_code, argval); double val = UnaryOpNode::eval_opcode(op_code, argval);
return AddPossiblyNegativeConstant(val); return AddPossiblyNegativeConstant(val);
} }
catch(ExprNode::EvalException &e) catch (ExprNode::EvalException &e)
{ {
} }
} }
...@@ -254,7 +260,7 @@ DataTree::AddBinaryOp(NodeID arg1, BinaryOpcode op_code, NodeID arg2) ...@@ -254,7 +260,7 @@ DataTree::AddBinaryOp(NodeID arg1, BinaryOpcode op_code, NodeID arg2)
double val = BinaryOpNode::eval_opcode(argval1, op_code, argval2); double val = BinaryOpNode::eval_opcode(argval1, op_code, argval2);
return AddPossiblyNegativeConstant(val); return AddPossiblyNegativeConstant(val);
} }
catch(ExprNode::EvalException &e) catch (ExprNode::EvalException &e)
{ {
} }
return new BinaryOpNode(*this, arg1, op_code, arg2); return new BinaryOpNode(*this, arg1, op_code, arg2);
...@@ -276,7 +282,7 @@ DataTree::AddTrinaryOp(NodeID arg1, TrinaryOpcode op_code, NodeID arg2, NodeID a ...@@ -276,7 +282,7 @@ DataTree::AddTrinaryOp(NodeID arg1, TrinaryOpcode op_code, NodeID arg2, NodeID a
double val = TrinaryOpNode::eval_opcode(argval1, op_code, argval2, argval3); double val = TrinaryOpNode::eval_opcode(argval1, op_code, argval2, argval3);
return AddPossiblyNegativeConstant(val); return AddPossiblyNegativeConstant(val);
} }
catch(ExprNode::EvalException &e) catch (ExprNode::EvalException &e)
{ {
} }
return new TrinaryOpNode(*this, arg1, op_code, arg2, arg3); return new TrinaryOpNode(*this, arg1, op_code, arg2, arg3);
......
This diff is collapsed.
...@@ -143,7 +143,7 @@ private: ...@@ -143,7 +143,7 @@ private:
//! Helper for writing the sparse Hessian or third derivatives in MATLAB and C //! Helper for writing the sparse Hessian or third derivatives in MATLAB and C
/*! If order=2, writes either v2(i+1,j+1) or v2[i+j*NNZDerivatives[1]] /*! If order=2, writes either v2(i+1,j+1) or v2[i+j*NNZDerivatives[1]]
If order=3, writes either v3(i+1,j+1) or v3[i+j*NNZDerivatives[2]] */ If order=3, writes either v3(i+1,j+1) or v3[i+j*NNZDerivatives[2]] */
void sparseHelper(int order, ostream &output, int row_nb, int col_nb, ExprNodeOutputType output_type) const; void sparseHelper(int order, ostream &output, int row_nb, int col_nb, ExprNodeOutputType output_type) const;
//! Write chain rule derivative of a recursive equation w.r. to a variable //! Write chain rule derivative of a recursive equation w.r. to a variable
...@@ -152,12 +152,10 @@ private: ...@@ -152,12 +152,10 @@ private:
//! Collecte the derivatives w.r. to endogenous of the block, to endogenous of previouys blocks and to exogenous //! Collecte the derivatives w.r. to endogenous of the block, to endogenous of previouys blocks and to exogenous
void collect_block_first_order_derivatives(); void collect_block_first_order_derivatives();