Commit dbc9795a authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Preprocessor: rename "NodeID" in "expr_t"

parent 25cf12f4
...@@ -647,7 +647,7 @@ CalibVarStatement::writeOutput(ostream &output, const string &basename) const ...@@ -647,7 +647,7 @@ CalibVarStatement::writeOutput(ostream &output, const string &basename) const
{ {
const string &name = it->first; const string &name = it->first;
const string &weight = it->second.first; const string &weight = it->second.first;
const NodeID expression = it->second.second; const expr_t expression = it->second.second;
int id = symbol_table.getTypeSpecificID(name) + 1; int id = symbol_table.getTypeSpecificID(name) + 1;
if (symbol_table.getType(name) == eEndogenous) if (symbol_table.getType(name) == eEndogenous)
...@@ -675,7 +675,7 @@ CalibVarStatement::writeOutput(ostream &output, const string &basename) const ...@@ -675,7 +675,7 @@ CalibVarStatement::writeOutput(ostream &output, const string &basename) const
const string &name1 = it->first.first; const string &name1 = it->first.first;
const string &name2 = it->first.second; const string &name2 = it->first.second;
const string &weight = it->second.first; const string &weight = it->second.first;
const NodeID expression = it->second.second; const expr_t expression = it->second.second;
int id1 = symbol_table.getTypeSpecificID(name1) + 1; int id1 = symbol_table.getTypeSpecificID(name1) + 1;
int id2 = symbol_table.getTypeSpecificID(name2) + 1; int id2 = symbol_table.getTypeSpecificID(name2) + 1;
...@@ -706,7 +706,7 @@ CalibVarStatement::writeOutput(ostream &output, const string &basename) const ...@@ -706,7 +706,7 @@ CalibVarStatement::writeOutput(ostream &output, const string &basename) const
const string &name = it->first.first; const string &name = it->first.first;
int iar = it->first.second + 3; int iar = it->first.second + 3;
const string &weight = it->second.first; const string &weight = it->second.first;
const NodeID expression = it->second.second; const expr_t expression = it->second.second;
int id = symbol_table.getTypeSpecificID(name) + 1; int id = symbol_table.getTypeSpecificID(name) + 1;
...@@ -810,7 +810,7 @@ OptimWeightsStatement::writeOutput(ostream &output, const string &basename) cons ...@@ -810,7 +810,7 @@ OptimWeightsStatement::writeOutput(ostream &output, const string &basename) cons
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 expr_t value = it->second;
int id = symbol_table.getTypeSpecificID(name) + 1; int id = symbol_table.getTypeSpecificID(name) + 1;
output << "optim_weights_(" << id << "," << id << ") = "; output << "optim_weights_(" << id << "," << id << ") = ";
value->writeOutput(output); value->writeOutput(output);
...@@ -823,7 +823,7 @@ OptimWeightsStatement::writeOutput(ostream &output, const string &basename) cons ...@@ -823,7 +823,7 @@ OptimWeightsStatement::writeOutput(ostream &output, const string &basename) cons
{ {
const string &name1 = it->first.first; const string &name1 = it->first.first;
const string &name2 = it->first.second; const string &name2 = it->first.second;
const NodeID value = it->second; const expr_t value = it->second;
int id1 = symbol_table.getTypeSpecificID(name1) + 1; int id1 = symbol_table.getTypeSpecificID(name1) + 1;
int id2 = symbol_table.getTypeSpecificID(name2) + 1; int id2 = symbol_table.getTypeSpecificID(name2) + 1;
output << "optim_weights_(" << id1 << "," << id2 << ") = "; output << "optim_weights_(" << id1 << "," << id2 << ") = ";
......
...@@ -169,7 +169,7 @@ public: ...@@ -169,7 +169,7 @@ public:
class ObservationTrendsStatement : public Statement class ObservationTrendsStatement : public Statement
{ {
public: public:
typedef map<string, NodeID> trend_elements_t; typedef map<string, expr_t> trend_elements_t;
private: private:
const trend_elements_t trend_elements; const trend_elements_t trend_elements;
const SymbolTable &symbol_table; const SymbolTable &symbol_table;
...@@ -241,7 +241,7 @@ class EstimationParams ...@@ -241,7 +241,7 @@ class EstimationParams
public: public:
int type; int type;
string name, name2, prior; string name, name2, prior;
NodeID init_val, low_bound, up_bound, mean, std, p3, p4, jscale; expr_t init_val, low_bound, up_bound, mean, std, p3, p4, jscale;
void void
init(const DataTree &datatree) init(const DataTree &datatree)
...@@ -298,8 +298,8 @@ public: ...@@ -298,8 +298,8 @@ public:
class OptimWeightsStatement : public Statement class OptimWeightsStatement : public Statement
{ {
public: public:
typedef map<string, NodeID> var_weights_t; typedef map<string, expr_t> var_weights_t;
typedef map<pair<string, string>, NodeID> covar_weights_t; typedef map<pair<string, string>, expr_t> covar_weights_t;
private: private:
const var_weights_t var_weights; const var_weights_t var_weights;
const covar_weights_t covar_weights; const covar_weights_t covar_weights;
...@@ -324,11 +324,11 @@ class CalibVarStatement : public Statement ...@@ -324,11 +324,11 @@ class CalibVarStatement : public Statement
{ {
public: public:
//! Maps a variable to a pair (weight, expression) //! Maps a variable to a pair (weight, expression)
typedef map<string, pair<string, NodeID> > calib_var_t; typedef map<string, pair<string, expr_t> > calib_var_t;
//! Maps a pair of variables to a pair (weight, expression) //! Maps a pair of variables to a pair (weight, expression)
typedef map<pair<string, string>, pair<string, NodeID> > calib_covar_t; typedef map<pair<string, string>, pair<string, expr_t> > calib_covar_t;
//! Maps a pair (variable, autocorr) to a pair (weight, expression) //! Maps a pair (variable, autocorr) to a pair (weight, expression)
typedef map<pair<string, int>, pair<string, NodeID> > calib_ac_t; typedef map<pair<string, int>, pair<string, expr_t> > calib_ac_t;
private: private:
const calib_var_t calib_var; const calib_var_t calib_var;
const calib_covar_t calib_covar; const calib_covar_t calib_covar;
......
...@@ -50,7 +50,7 @@ DataTree::~DataTree() ...@@ -50,7 +50,7 @@ DataTree::~DataTree()
delete *it; delete *it;
} }
NodeID expr_t
DataTree::AddNumConstant(const string &value) DataTree::AddNumConstant(const string &value)
{ {
int id = num_constants.AddConstant(value); int id = num_constants.AddConstant(value);
...@@ -79,8 +79,8 @@ DataTree::AddVariable(int symb_id, int lag) ...@@ -79,8 +79,8 @@ DataTree::AddVariable(int symb_id, int lag)
return AddVariableInternal(symb_id, lag); return AddVariableInternal(symb_id, lag);
} }
NodeID expr_t
DataTree::AddPlus(NodeID iArg1, NodeID iArg2) DataTree::AddPlus(expr_t iArg1, expr_t iArg2)
{ {
if (iArg1 != Zero && iArg2 != Zero) if (iArg1 != Zero && iArg2 != Zero)
{ {
...@@ -93,7 +93,7 @@ DataTree::AddPlus(NodeID iArg1, NodeID iArg2) ...@@ -93,7 +93,7 @@ DataTree::AddPlus(NodeID iArg1, NodeID iArg2)
// Nodes iArg1 and iArg2 are sorted by index // Nodes iArg1 and iArg2 are sorted by index
if (iArg1->idx > iArg2->idx) if (iArg1->idx > iArg2->idx)
{ {
NodeID tmp = iArg1; expr_t tmp = iArg1;
iArg1 = iArg2; iArg1 = iArg2;
iArg2 = tmp; iArg2 = tmp;
} }
...@@ -107,8 +107,8 @@ DataTree::AddPlus(NodeID iArg1, NodeID iArg2) ...@@ -107,8 +107,8 @@ DataTree::AddPlus(NodeID iArg1, NodeID iArg2)
return Zero; return Zero;
} }
NodeID expr_t
DataTree::AddMinus(NodeID iArg1, NodeID iArg2) DataTree::AddMinus(expr_t iArg1, expr_t iArg2)
{ {
if (iArg2 == Zero) if (iArg2 == Zero)
return iArg1; return iArg1;
...@@ -122,8 +122,8 @@ DataTree::AddMinus(NodeID iArg1, NodeID iArg2) ...@@ -122,8 +122,8 @@ DataTree::AddMinus(NodeID iArg1, NodeID iArg2)
return AddBinaryOp(iArg1, oMinus, iArg2); return AddBinaryOp(iArg1, oMinus, iArg2);
} }
NodeID expr_t
DataTree::AddUMinus(NodeID iArg1) DataTree::AddUMinus(expr_t iArg1)
{ {
if (iArg1 != Zero) if (iArg1 != Zero)
{ {
...@@ -138,8 +138,8 @@ DataTree::AddUMinus(NodeID iArg1) ...@@ -138,8 +138,8 @@ DataTree::AddUMinus(NodeID iArg1)
return Zero; return Zero;
} }
NodeID expr_t
DataTree::AddTimes(NodeID iArg1, NodeID iArg2) DataTree::AddTimes(expr_t iArg1, expr_t iArg2)
{ {
if (iArg1 == MinusOne) if (iArg1 == MinusOne)
return AddUMinus(iArg2); return AddUMinus(iArg2);
...@@ -151,7 +151,7 @@ DataTree::AddTimes(NodeID iArg1, NodeID iArg2) ...@@ -151,7 +151,7 @@ DataTree::AddTimes(NodeID iArg1, NodeID iArg2)
// Nodes iArg1 and iArg2 are sorted by index // Nodes iArg1 and iArg2 are sorted by index
if (iArg1->idx > iArg2->idx) if (iArg1->idx > iArg2->idx)
{ {
NodeID tmp = iArg1; expr_t tmp = iArg1;
iArg1 = iArg2; iArg1 = iArg2;
iArg2 = tmp; iArg2 = tmp;
} }
...@@ -167,8 +167,8 @@ DataTree::AddTimes(NodeID iArg1, NodeID iArg2) ...@@ -167,8 +167,8 @@ DataTree::AddTimes(NodeID iArg1, NodeID iArg2)
return Zero; return Zero;
} }
NodeID expr_t
DataTree::AddDivide(NodeID iArg1, NodeID iArg2) DataTree::AddDivide(expr_t iArg1, expr_t iArg2)
{ {
if (iArg2 == One) if (iArg2 == One)
return iArg1; return iArg1;
...@@ -189,44 +189,44 @@ DataTree::AddDivide(NodeID iArg1, NodeID iArg2) ...@@ -189,44 +189,44 @@ DataTree::AddDivide(NodeID iArg1, NodeID iArg2)
return AddBinaryOp(iArg1, oDivide, iArg2); return AddBinaryOp(iArg1, oDivide, iArg2);
} }
NodeID expr_t
DataTree::AddLess(NodeID iArg1, NodeID iArg2) DataTree::AddLess(expr_t iArg1, expr_t iArg2)
{ {
return AddBinaryOp(iArg1, oLess, iArg2); return AddBinaryOp(iArg1, oLess, iArg2);
} }
NodeID expr_t
DataTree::AddGreater(NodeID iArg1, NodeID iArg2) DataTree::AddGreater(expr_t iArg1, expr_t iArg2)
{ {
return AddBinaryOp(iArg1, oGreater, iArg2); return AddBinaryOp(iArg1, oGreater, iArg2);
} }
NodeID expr_t
DataTree::AddLessEqual(NodeID iArg1, NodeID iArg2) DataTree::AddLessEqual(expr_t iArg1, expr_t iArg2)
{ {
return AddBinaryOp(iArg1, oLessEqual, iArg2); return AddBinaryOp(iArg1, oLessEqual, iArg2);
} }
NodeID expr_t
DataTree::AddGreaterEqual(NodeID iArg1, NodeID iArg2) DataTree::AddGreaterEqual(expr_t iArg1, expr_t iArg2)
{ {
return AddBinaryOp(iArg1, oGreaterEqual, iArg2); return AddBinaryOp(iArg1, oGreaterEqual, iArg2);
} }
NodeID expr_t
DataTree::AddEqualEqual(NodeID iArg1, NodeID iArg2) DataTree::AddEqualEqual(expr_t iArg1, expr_t iArg2)
{ {
return AddBinaryOp(iArg1, oEqualEqual, iArg2); return AddBinaryOp(iArg1, oEqualEqual, iArg2);
} }
NodeID expr_t
DataTree::AddDifferent(NodeID iArg1, NodeID iArg2) DataTree::AddDifferent(expr_t iArg1, expr_t iArg2)
{ {
return AddBinaryOp(iArg1, oDifferent, iArg2); return AddBinaryOp(iArg1, oDifferent, iArg2);
} }
NodeID expr_t
DataTree::AddPower(NodeID iArg1, NodeID iArg2) DataTree::AddPower(expr_t iArg1, expr_t iArg2)
{ {
if (iArg1 != Zero && iArg2 != Zero && iArg2 != One) if (iArg1 != Zero && iArg2 != Zero && iArg2 != One)
return AddBinaryOp(iArg1, oPower, iArg2); return AddBinaryOp(iArg1, oPower, iArg2);
...@@ -238,8 +238,8 @@ DataTree::AddPower(NodeID iArg1, NodeID iArg2) ...@@ -238,8 +238,8 @@ DataTree::AddPower(NodeID iArg1, NodeID iArg2)
return Zero; return Zero;
} }
NodeID expr_t
DataTree::AddExp(NodeID iArg1) DataTree::AddExp(expr_t iArg1)
{ {
if (iArg1 != Zero) if (iArg1 != Zero)
return AddUnaryOp(oExp, iArg1); return AddUnaryOp(oExp, iArg1);
...@@ -247,8 +247,8 @@ DataTree::AddExp(NodeID iArg1) ...@@ -247,8 +247,8 @@ DataTree::AddExp(NodeID iArg1)
return One; return One;
} }
NodeID expr_t
DataTree::AddLog(NodeID iArg1) DataTree::AddLog(expr_t iArg1)
{ {
if (iArg1 != Zero && iArg1 != One) if (iArg1 != Zero && iArg1 != One)
return AddUnaryOp(oLog, iArg1); return AddUnaryOp(oLog, iArg1);
...@@ -261,8 +261,8 @@ DataTree::AddLog(NodeID iArg1) ...@@ -261,8 +261,8 @@ DataTree::AddLog(NodeID iArg1)
} }
} }
NodeID expr_t
DataTree::AddLog10(NodeID iArg1) DataTree::AddLog10(expr_t iArg1)
{ {
if (iArg1 != Zero && iArg1 != One) if (iArg1 != Zero && iArg1 != One)
return AddUnaryOp(oLog10, iArg1); return AddUnaryOp(oLog10, iArg1);
...@@ -275,8 +275,8 @@ DataTree::AddLog10(NodeID iArg1) ...@@ -275,8 +275,8 @@ DataTree::AddLog10(NodeID iArg1)
} }
} }
NodeID expr_t
DataTree::AddCos(NodeID iArg1) DataTree::AddCos(expr_t iArg1)
{ {
if (iArg1 != Zero) if (iArg1 != Zero)
return AddUnaryOp(oCos, iArg1); return AddUnaryOp(oCos, iArg1);
...@@ -284,8 +284,8 @@ DataTree::AddCos(NodeID iArg1) ...@@ -284,8 +284,8 @@ DataTree::AddCos(NodeID iArg1)
return One; return One;
} }
NodeID expr_t
DataTree::AddSin(NodeID iArg1) DataTree::AddSin(expr_t iArg1)
{ {
if (iArg1 != Zero) if (iArg1 != Zero)
return AddUnaryOp(oSin, iArg1); return AddUnaryOp(oSin, iArg1);
...@@ -293,8 +293,8 @@ DataTree::AddSin(NodeID iArg1) ...@@ -293,8 +293,8 @@ DataTree::AddSin(NodeID iArg1)
return Zero; return Zero;
} }
NodeID expr_t
DataTree::AddTan(NodeID iArg1) DataTree::AddTan(expr_t iArg1)
{ {
if (iArg1 != Zero) if (iArg1 != Zero)
return AddUnaryOp(oTan, iArg1); return AddUnaryOp(oTan, iArg1);
...@@ -302,8 +302,8 @@ DataTree::AddTan(NodeID iArg1) ...@@ -302,8 +302,8 @@ DataTree::AddTan(NodeID iArg1)
return Zero; return Zero;
} }
NodeID expr_t
DataTree::AddAcos(NodeID iArg1) DataTree::AddAcos(expr_t iArg1)
{ {
if (iArg1 != One) if (iArg1 != One)
return AddUnaryOp(oAcos, iArg1); return AddUnaryOp(oAcos, iArg1);
...@@ -311,8 +311,8 @@ DataTree::AddAcos(NodeID iArg1) ...@@ -311,8 +311,8 @@ DataTree::AddAcos(NodeID iArg1)
return Zero; return Zero;
} }
NodeID expr_t
DataTree::AddAsin(NodeID iArg1) DataTree::AddAsin(expr_t iArg1)
{ {
if (iArg1 != Zero) if (iArg1 != Zero)
return AddUnaryOp(oAsin, iArg1); return AddUnaryOp(oAsin, iArg1);
...@@ -320,8 +320,8 @@ DataTree::AddAsin(NodeID iArg1) ...@@ -320,8 +320,8 @@ DataTree::AddAsin(NodeID iArg1)
return Zero; return Zero;
} }
NodeID expr_t
DataTree::AddAtan(NodeID iArg1) DataTree::AddAtan(expr_t iArg1)
{ {
if (iArg1 != Zero) if (iArg1 != Zero)
return AddUnaryOp(oAtan, iArg1); return AddUnaryOp(oAtan, iArg1);
...@@ -329,8 +329,8 @@ DataTree::AddAtan(NodeID iArg1) ...@@ -329,8 +329,8 @@ DataTree::AddAtan(NodeID iArg1)
return Zero; return Zero;
} }
NodeID expr_t
DataTree::AddCosh(NodeID iArg1) DataTree::AddCosh(expr_t iArg1)
{ {
if (iArg1 != Zero) if (iArg1 != Zero)
return AddUnaryOp(oCosh, iArg1); return AddUnaryOp(oCosh, iArg1);
...@@ -338,8 +338,8 @@ DataTree::AddCosh(NodeID iArg1) ...@@ -338,8 +338,8 @@ DataTree::AddCosh(NodeID iArg1)
return One; return One;
} }
NodeID expr_t
DataTree::AddSinh(NodeID iArg1) DataTree::AddSinh(expr_t iArg1)
{ {
if (iArg1 != Zero) if (iArg1 != Zero)
return AddUnaryOp(oSinh, iArg1); return AddUnaryOp(oSinh, iArg1);
...@@ -347,8 +347,8 @@ DataTree::AddSinh(NodeID iArg1) ...@@ -347,8 +347,8 @@ DataTree::AddSinh(NodeID iArg1)
return Zero; return Zero;
} }
NodeID expr_t
DataTree::AddTanh(NodeID iArg1) DataTree::AddTanh(expr_t iArg1)
{ {
if (iArg1 != Zero) if (iArg1 != Zero)
return AddUnaryOp(oTanh, iArg1); return AddUnaryOp(oTanh, iArg1);
...@@ -356,8 +356,8 @@ DataTree::AddTanh(NodeID iArg1) ...@@ -356,8 +356,8 @@ DataTree::AddTanh(NodeID iArg1)
return Zero; return Zero;
} }
NodeID expr_t
DataTree::AddAcosh(NodeID iArg1) DataTree::AddAcosh(expr_t iArg1)
{ {
if (iArg1 != One) if (iArg1 != One)
return AddUnaryOp(oAcosh, iArg1); return AddUnaryOp(oAcosh, iArg1);
...@@ -365,8 +365,8 @@ DataTree::AddAcosh(NodeID iArg1) ...@@ -365,8 +365,8 @@ DataTree::AddAcosh(NodeID iArg1)
return Zero; return Zero;
} }
NodeID expr_t
DataTree::AddAsinh(NodeID iArg1) DataTree::AddAsinh(expr_t iArg1)
{ {
if (iArg1 != Zero) if (iArg1 != Zero)
return AddUnaryOp(oAsinh, iArg1); return AddUnaryOp(oAsinh, iArg1);
...@@ -374,8 +374,8 @@ DataTree::AddAsinh(NodeID iArg1) ...@@ -374,8 +374,8 @@ DataTree::AddAsinh(NodeID iArg1)
return Zero; return Zero;
} }
NodeID expr_t
DataTree::AddAtanh(NodeID iArg1) DataTree::AddAtanh(expr_t iArg1)
{ {
if (iArg1 != Zero) if (iArg1 != Zero)
return AddUnaryOp(oAtanh, iArg1); return AddUnaryOp(oAtanh, iArg1);
...@@ -383,8 +383,8 @@ DataTree::AddAtanh(NodeID iArg1) ...@@ -383,8 +383,8 @@ DataTree::AddAtanh(NodeID iArg1)
return Zero; return Zero;
} }
NodeID expr_t
DataTree::AddSqrt(NodeID iArg1) DataTree::AddSqrt(expr_t iArg1)
{ {
if (iArg1 != Zero) if (iArg1 != Zero)
return AddUnaryOp(oSqrt, iArg1); return AddUnaryOp(oSqrt, iArg1);
...@@ -392,8 +392,8 @@ DataTree::AddSqrt(NodeID iArg1) ...@@ -392,8 +392,8 @@ DataTree::AddSqrt(NodeID iArg1)
return Zero; return Zero;
} }
NodeID expr_t
DataTree::AddErf(NodeID iArg1) DataTree::AddErf(expr_t iArg1)
{ {
if (iArg1 != Zero) if (iArg1 != Zero)
return AddUnaryOp(oErf, iArg1); return AddUnaryOp(oErf, iArg1);
...@@ -401,69 +401,69 @@ DataTree::AddErf(NodeID iArg1) ...@@ -401,69 +401,69 @@ DataTree::AddErf(NodeID iArg1)
return Zero; return Zero;
} }
NodeID expr_t
DataTree::AddMax(NodeID iArg1, NodeID iArg2) DataTree::AddMax(expr_t iArg1, expr_t iArg2)
{ {
return AddBinaryOp(iArg1, oMax, iArg2); return AddBinaryOp(iArg1, oMax, iArg2);
} }
NodeID expr_t
DataTree::AddMin(NodeID iArg1, NodeID iArg2) DataTree::AddMin(expr_t iArg1, expr_t iArg2)
{ {
return AddBinaryOp(iArg1, oMin, iArg2); return AddBinaryOp(iArg1, oMin, iArg2);
} }
NodeID expr_t
DataTree::AddNormcdf(NodeID iArg1, NodeID iArg2, NodeID iArg3) DataTree::AddNormcdf(expr_t iArg1, expr_t iArg2, expr_t iArg3)
{ {
return AddTrinaryOp(iArg1, oNormcdf, iArg2, iArg3); return AddTrinaryOp(iArg1, oNormcdf, iArg2, iArg3);
} }