v4 parser:
* fixed operators precedence (in particular for relational operators) * various minor cleanups git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1483 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
ddc81ce534
commit
10bdf16a2a
|
@ -303,18 +303,6 @@ MarkowitzStatement::writeOutput(ostream &output, const string &basename) const
|
||||||
output << "options_.markowitz = " << markowitz << ";" << endl;
|
output << "options_.markowitz = " << markowitz << ";" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Simulation_MethodStatement::Simulation_MethodStatement(double simulation_method_arg) : simulation_method(simulation_method_arg)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
Simulation_MethodStatement::writeOutput(ostream &output, const string &basename) const
|
|
||||||
{
|
|
||||||
output << "options_.simulation_method = " << simulation_method << ";" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DsampleStatement::DsampleStatement(int val1_arg) : val1(val1_arg), val2(-1)
|
DsampleStatement::DsampleStatement(int val1_arg) : val1(val1_arg), val2(-1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,6 @@ NumConstNode::eval(const eval_context_type &eval_context) const throw (EvalExcep
|
||||||
return(datatree.num_constants.getDouble(id));
|
return(datatree.num_constants.getDouble(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*New*/
|
|
||||||
void
|
void
|
||||||
NumConstNode::compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const
|
NumConstNode::compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const
|
||||||
{
|
{
|
||||||
|
@ -151,7 +150,6 @@ NumConstNode::compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType ou
|
||||||
CompileCode.write(reinterpret_cast<char *>(&vard),sizeof(vard));
|
CompileCode.write(reinterpret_cast<char *>(&vard),sizeof(vard));
|
||||||
/*}*/
|
/*}*/
|
||||||
}
|
}
|
||||||
/*EndNew*/
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -248,12 +246,6 @@ VariableNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
output << "T" << idx << "(it_)";
|
output << "T" << idx << "(it_)";
|
||||||
else
|
else
|
||||||
output << "T" << idx;
|
output << "T" << idx;
|
||||||
/*if (output_type != oCDynamicModelSparseDLL)
|
|
||||||
output << "T" << idx;
|
|
||||||
else if (output_type == oMatlabDynamicModelSparse)
|
|
||||||
output << "T" << idx << "(it_)";
|
|
||||||
else
|
|
||||||
output << "T" << idx << "[it_]";*/
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,7 +403,6 @@ VariableNode::eval(const eval_context_type &eval_context) const throw (EvalExcep
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*New*/
|
|
||||||
void
|
void
|
||||||
VariableNode::compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const
|
VariableNode::compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const
|
||||||
{
|
{
|
||||||
|
@ -471,7 +462,6 @@ VariableNode::compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType ou
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*EndNew*/
|
|
||||||
|
|
||||||
void
|
void
|
||||||
VariableNode::collectEndogenous(NodeID &Id)
|
VariableNode::collectEndogenous(NodeID &Id)
|
||||||
|
@ -709,12 +699,6 @@ UnaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
output << "T" << idx << "(it_)";
|
output << "T" << idx << "(it_)";
|
||||||
else
|
else
|
||||||
output << "T" << idx;
|
output << "T" << idx;
|
||||||
/*if (output_type != oCDynamicModelSparseDLL)
|
|
||||||
output << "T" << idx;
|
|
||||||
else if (output_type == oMatlabDynamicModelSparse)
|
|
||||||
output << "T" << idx << "(it_)";
|
|
||||||
else
|
|
||||||
output << "T" << idx << "[it_]";*/
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -722,9 +706,6 @@ UnaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
if (op_code == oUminus)
|
if (op_code == oUminus)
|
||||||
output << "(";
|
output << "(";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch(op_code)
|
switch(op_code)
|
||||||
{
|
{
|
||||||
case oUminus:
|
case oUminus:
|
||||||
|
@ -857,7 +838,6 @@ UnaryOpNode::eval(const eval_context_type &eval_context) const throw (EvalExcept
|
||||||
return eval_opcode(op_code, v);
|
return eval_opcode(op_code, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*New*/
|
|
||||||
void
|
void
|
||||||
UnaryOpNode::compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const
|
UnaryOpNode::compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const
|
||||||
{
|
{
|
||||||
|
@ -874,7 +854,6 @@ UnaryOpNode::compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType out
|
||||||
UnaryOpcode op_codel=op_code;
|
UnaryOpcode op_codel=op_code;
|
||||||
CompileCode.write(reinterpret_cast<char *>(&op_codel), sizeof(op_codel));
|
CompileCode.write(reinterpret_cast<char *>(&op_codel), sizeof(op_codel));
|
||||||
}
|
}
|
||||||
/*EndNEw*/
|
|
||||||
|
|
||||||
void
|
void
|
||||||
UnaryOpNode::collectEndogenous(NodeID &Id)
|
UnaryOpNode::collectEndogenous(NodeID &Id)
|
||||||
|
@ -982,28 +961,31 @@ BinaryOpNode::precedence(ExprNodeOutputType output_type, const temporary_terms_t
|
||||||
|
|
||||||
switch(op_code)
|
switch(op_code)
|
||||||
{
|
{
|
||||||
|
case oEqual:
|
||||||
|
return 0;
|
||||||
case oEqualEqual:
|
case oEqualEqual:
|
||||||
case oDifferent:
|
case oDifferent:
|
||||||
|
return 1;
|
||||||
case oLessEqual:
|
case oLessEqual:
|
||||||
case oGreaterEqual:
|
case oGreaterEqual:
|
||||||
case oLess:
|
case oLess:
|
||||||
case oGreater:
|
case oGreater:
|
||||||
case oMin:
|
return 2;
|
||||||
case oMax:
|
|
||||||
return 0;
|
|
||||||
case oEqual:
|
|
||||||
case oPlus:
|
case oPlus:
|
||||||
case oMinus:
|
case oMinus:
|
||||||
return 1;
|
return 3;
|
||||||
case oTimes:
|
case oTimes:
|
||||||
case oDivide:
|
case oDivide:
|
||||||
return 2;
|
return 4;
|
||||||
case oPower:
|
case oPower:
|
||||||
if (!OFFSET(output_type))
|
if (!OFFSET(output_type))
|
||||||
// In C, power operator is of the form pow(a, b)
|
// In C, power operator is of the form pow(a, b)
|
||||||
return 100;
|
return 100;
|
||||||
else
|
else
|
||||||
return 4;
|
return 5;
|
||||||
|
case oMin:
|
||||||
|
case oMax:
|
||||||
|
return 100;
|
||||||
}
|
}
|
||||||
cerr << "Impossible case!" << endl;
|
cerr << "Impossible case!" << endl;
|
||||||
exit(-1);
|
exit(-1);
|
||||||
|
@ -1144,26 +1126,26 @@ BinaryOpNode::eval_opcode(double v1, BinaryOpcode op_code, double v2) throw (Eva
|
||||||
return(pow(v1, v2));
|
return(pow(v1, v2));
|
||||||
case oMax:
|
case oMax:
|
||||||
if (v1 < v2)
|
if (v1 < v2)
|
||||||
return( v2);
|
return v2;
|
||||||
else
|
else
|
||||||
return( v1);
|
return v1;
|
||||||
case oMin:
|
case oMin:
|
||||||
if (v1 > v2)
|
if (v1 > v2)
|
||||||
return( v2);
|
return v2;
|
||||||
else
|
else
|
||||||
return( v1);
|
return v1;
|
||||||
case oLess:
|
case oLess:
|
||||||
return( v1< v2 ? 1.0 : 0.0);
|
return (v1 < v2);
|
||||||
case oGreater:
|
case oGreater:
|
||||||
return( v1> v2 ? 1.0 : 0.0);
|
return (v1 > v2);
|
||||||
case oLessEqual:
|
case oLessEqual:
|
||||||
return( v1<= v2 ? 1.0 : 0.0);
|
return (v1 <= v2);
|
||||||
case oGreaterEqual:
|
case oGreaterEqual:
|
||||||
return( v1>= v2 ? 1.0 : 0.0);
|
return (v1 >= v2);
|
||||||
case oEqualEqual:
|
case oEqualEqual:
|
||||||
return( v1== v2 ? 1.0 : 0.0);
|
return (v1 == v2);
|
||||||
case oDifferent:
|
case oDifferent:
|
||||||
return( v1!= v2 ? 1.0 : 0.0);
|
return (v1 != v2);
|
||||||
case oEqual:
|
case oEqual:
|
||||||
throw EvalException();
|
throw EvalException();
|
||||||
}
|
}
|
||||||
|
@ -1180,7 +1162,6 @@ BinaryOpNode::eval(const eval_context_type &eval_context) const throw (EvalExcep
|
||||||
return eval_opcode(v1, op_code, v2);
|
return eval_opcode(v1, op_code, v2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*New*/
|
|
||||||
void
|
void
|
||||||
BinaryOpNode::compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const
|
BinaryOpNode::compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const
|
||||||
{
|
{
|
||||||
|
@ -1199,7 +1180,6 @@ BinaryOpNode::compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType ou
|
||||||
BinaryOpcode op_codel=op_code;
|
BinaryOpcode op_codel=op_code;
|
||||||
CompileCode.write(reinterpret_cast<char *>(&op_codel),sizeof(op_codel));
|
CompileCode.write(reinterpret_cast<char *>(&op_codel),sizeof(op_codel));
|
||||||
}
|
}
|
||||||
/*EndNew*/
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
BinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
|
@ -1215,16 +1195,10 @@ BinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
output << "T" << idx << "(it_)";
|
output << "T" << idx << "(it_)";
|
||||||
else
|
else
|
||||||
output << "T" << idx;
|
output << "T" << idx;
|
||||||
/*if (output_type != oCDynamicModelSparseDLL)
|
|
||||||
output << "T" << idx;
|
|
||||||
else if (output_type == oMatlabDynamicModelSparse)
|
|
||||||
output << "T" << idx << "(it_)";
|
|
||||||
else
|
|
||||||
output << "T" << idx << "[it_]";*/
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Treat special case of power operator in C
|
// Treat special case of power operator in C, and case of max and min operators
|
||||||
if ((op_code == oPower && !OFFSET(output_type)) || op_code == oMax || op_code == oMin )
|
if ((op_code == oPower && !OFFSET(output_type)) || op_code == oMax || op_code == oMin )
|
||||||
{
|
{
|
||||||
switch (op_code)
|
switch (op_code)
|
||||||
|
@ -1238,7 +1212,8 @@ BinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
case oMin:
|
case oMin:
|
||||||
output << "min(";
|
output << "min(";
|
||||||
break;
|
break;
|
||||||
default:;
|
default:
|
||||||
|
;
|
||||||
}
|
}
|
||||||
arg1->writeOutput(output, output_type, temporary_terms);
|
arg1->writeOutput(output, output_type, temporary_terms);
|
||||||
output << ",";
|
output << ",";
|
||||||
|
@ -1308,7 +1283,8 @@ BinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
case oEqual:
|
case oEqual:
|
||||||
output << "=";
|
output << "=";
|
||||||
break;
|
break;
|
||||||
default:;
|
default:
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
close_parenthesis = false;
|
close_parenthesis = false;
|
||||||
|
@ -1354,7 +1330,8 @@ TrinaryOpNode::TrinaryOpNode(DataTree &datatree_arg, const NodeID arg1_arg,
|
||||||
datatree.trinary_op_node_map[make_pair(make_pair(make_pair(arg1, arg2), arg3), op_code)] = this;
|
datatree.trinary_op_node_map[make_pair(make_pair(make_pair(arg1, arg2), arg3), op_code)] = this;
|
||||||
|
|
||||||
// Non-null derivatives are the union of those of the arguments
|
// Non-null derivatives are the union of those of the arguments
|
||||||
// Compute set union of arg1->non_null_derivatives and arg2->non_null_derivatives
|
// Compute set union of arg{1,2,3}->non_null_derivatives
|
||||||
|
set<int> non_null_derivatives_tmp;
|
||||||
set_union(arg1->non_null_derivatives.begin(),
|
set_union(arg1->non_null_derivatives.begin(),
|
||||||
arg1->non_null_derivatives.end(),
|
arg1->non_null_derivatives.end(),
|
||||||
arg2->non_null_derivatives.begin(),
|
arg2->non_null_derivatives.begin(),
|
||||||
|
@ -1546,9 +1523,9 @@ TrinaryOpNode::eval(const eval_context_type &eval_context) const throw (EvalExce
|
||||||
return eval_opcode(v1, op_code, v2, v3);
|
return eval_opcode(v1, op_code, v2, v3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*New*/
|
|
||||||
void
|
void
|
||||||
TrinaryOpNode::compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const
|
TrinaryOpNode::compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type,
|
||||||
|
const temporary_terms_type &temporary_terms, map_idx_type map_idx) const
|
||||||
{
|
{
|
||||||
// If current node is a temporary term
|
// If current node is a temporary term
|
||||||
temporary_terms_type::const_iterator it = temporary_terms.find(const_cast<TrinaryOpNode *>(this));
|
temporary_terms_type::const_iterator it = temporary_terms.find(const_cast<TrinaryOpNode *>(this));
|
||||||
|
@ -1566,13 +1543,11 @@ TrinaryOpNode::compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType o
|
||||||
TrinaryOpcode op_codel=op_code;
|
TrinaryOpcode op_codel=op_code;
|
||||||
CompileCode.write(reinterpret_cast<char *>(&op_codel),sizeof(op_codel));
|
CompileCode.write(reinterpret_cast<char *>(&op_codel),sizeof(op_codel));
|
||||||
}
|
}
|
||||||
/*EndNew*/
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TrinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
TrinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
const temporary_terms_type &temporary_terms) const
|
const temporary_terms_type &temporary_terms) const
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!OFFSET(output_type))
|
if (!OFFSET(output_type))
|
||||||
{
|
{
|
||||||
cerr << "TrinaryOpNode not implemented for C output" << endl;
|
cerr << "TrinaryOpNode not implemented for C output" << endl;
|
||||||
|
|
|
@ -200,15 +200,6 @@ ParsingDriver::markowitz(string *markowitz)
|
||||||
delete markowitz;
|
delete markowitz;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
ParsingDriver::simulation_method(string *simulation_method)
|
|
||||||
{
|
|
||||||
double simulation_method_val = atof(simulation_method->c_str());
|
|
||||||
mod_file->addStatement(new Simulation_MethodStatement(simulation_method_val ));
|
|
||||||
delete simulation_method;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ParsingDriver::dsample(string *arg1)
|
ParsingDriver::dsample(string *arg1)
|
||||||
{
|
{
|
||||||
|
@ -533,12 +524,9 @@ ParsingDriver::add_value(NodeID value)
|
||||||
void
|
void
|
||||||
ParsingDriver::add_value(string *p1)
|
ParsingDriver::add_value(string *p1)
|
||||||
{
|
{
|
||||||
//int p1_val = atoi(p1->c_str());
|
|
||||||
det_shocks_values.push_back(add_constant(p1));
|
det_shocks_values.push_back(add_constant(p1));
|
||||||
//delete p1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ParsingDriver::do_sigma_e()
|
ParsingDriver::do_sigma_e()
|
||||||
{
|
{
|
||||||
|
@ -572,23 +560,15 @@ ParsingDriver::add_to_row(NodeID v)
|
||||||
sigmae_row.push_back(v);
|
sigmae_row.push_back(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ParsingDriver::steady()
|
ParsingDriver::steady()
|
||||||
{
|
{
|
||||||
if (/*mod_file->model_tree.mode == eSparseDLLMode || */mod_file->model_tree.mode == eSparseMode)
|
if (mod_file->model_tree.mode == eSparseMode)
|
||||||
{
|
|
||||||
mod_file->addStatement(new SteadySparseStatement(options_list));
|
mod_file->addStatement(new SteadySparseStatement(options_list));
|
||||||
options_list.clear();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
mod_file->addStatement(new SteadyStatement(options_list));
|
mod_file->addStatement(new SteadyStatement(options_list));
|
||||||
options_list.clear();
|
options_list.clear();
|
||||||
}
|
}
|
||||||
/*mod_file->addStatement(new SteadyStatement(options_list));
|
|
||||||
options_list.clear();*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ParsingDriver::option_num(const string &name_option, string *opt1, string *opt2)
|
ParsingDriver::option_num(const string &name_option, string *opt1, string *opt2)
|
||||||
|
@ -1145,9 +1125,6 @@ ParsingDriver::add_different(NodeID arg1, NodeID arg2)
|
||||||
return data_tree->AddDifferent(arg1, arg2);
|
return data_tree->AddDifferent(arg1, arg2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
NodeID
|
NodeID
|
||||||
ParsingDriver::add_power(NodeID arg1, NodeID arg2)
|
ParsingDriver::add_power(NodeID arg1, NodeID arg2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -119,15 +119,6 @@ public:
|
||||||
virtual void writeOutput(ostream &output, const string &basename) const;
|
virtual void writeOutput(ostream &output, const string &basename) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Simulation_MethodStatement : public Statement
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
const int simulation_method;
|
|
||||||
public:
|
|
||||||
Simulation_MethodStatement(double simulation_method_arg) ;
|
|
||||||
void writeOutput(ostream &output, const string &basename) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
class MarkowitzStatement : public Statement
|
class MarkowitzStatement : public Statement
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -14,6 +14,8 @@ using namespace std;
|
||||||
#include "VariableTable.hh"
|
#include "VariableTable.hh"
|
||||||
#include "ExprNode.hh"
|
#include "ExprNode.hh"
|
||||||
|
|
||||||
|
#define CONSTANTS_PRECISION 16
|
||||||
|
|
||||||
class DataTree
|
class DataTree
|
||||||
{
|
{
|
||||||
friend class ExprNode;
|
friend class ExprNode;
|
||||||
|
@ -151,7 +153,7 @@ DataTree::AddPossiblyNegativeConstant(double v)
|
||||||
neg = true;
|
neg = true;
|
||||||
}
|
}
|
||||||
ostringstream ost;
|
ostringstream ost;
|
||||||
ost << setprecision(16) << v;
|
ost << setprecision(CONSTANTS_PRECISION) << v;
|
||||||
|
|
||||||
NodeID cnode = AddNumConstant(ost.str());
|
NodeID cnode = AddNumConstant(ost.str());
|
||||||
|
|
||||||
|
|
|
@ -140,10 +140,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual double eval(const eval_context_type &eval_context) const throw (EvalException) = 0;
|
virtual double eval(const eval_context_type &eval_context) const throw (EvalException) = 0;
|
||||||
/*New*/
|
|
||||||
virtual void compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const = 0;
|
virtual void compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const = 0;
|
||||||
/*EndNew*/
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Object used to compare two nodes (using their indexes)
|
//! Object used to compare two nodes (using their indexes)
|
||||||
|
@ -168,9 +165,7 @@ public:
|
||||||
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms) const;
|
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms) const;
|
||||||
virtual void collectEndogenous(NodeID &Id);
|
virtual void collectEndogenous(NodeID &Id);
|
||||||
virtual double eval(const eval_context_type &eval_context) const throw (EvalException);
|
virtual double eval(const eval_context_type &eval_context) const throw (EvalException);
|
||||||
/*New*/
|
|
||||||
virtual void compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const;
|
virtual void compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const;
|
||||||
/*EndNew*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Symbol or variable node
|
//! Symbol or variable node
|
||||||
|
@ -189,9 +184,7 @@ public:
|
||||||
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms = temporary_terms_type()) const;
|
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms = temporary_terms_type()) const;
|
||||||
virtual void collectEndogenous(NodeID &Id);
|
virtual void collectEndogenous(NodeID &Id);
|
||||||
virtual double eval(const eval_context_type &eval_context) const throw (EvalException);
|
virtual double eval(const eval_context_type &eval_context) const throw (EvalException);
|
||||||
/*New*/
|
|
||||||
virtual void compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const;
|
virtual void compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const;
|
||||||
/*EndNew*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum UnaryOpcode
|
enum UnaryOpcode
|
||||||
|
@ -238,9 +231,7 @@ public:
|
||||||
virtual void collectEndogenous(NodeID &Id);
|
virtual void collectEndogenous(NodeID &Id);
|
||||||
static double eval_opcode(UnaryOpcode op_code, double v) throw (EvalException);
|
static double eval_opcode(UnaryOpcode op_code, double v) throw (EvalException);
|
||||||
virtual double eval(const eval_context_type &eval_context) const throw (EvalException);
|
virtual double eval(const eval_context_type &eval_context) const throw (EvalException);
|
||||||
/*New*/
|
|
||||||
virtual void compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const;
|
virtual void compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const;
|
||||||
/*EndNew*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum BinaryOpcode
|
enum BinaryOpcode
|
||||||
|
@ -285,9 +276,7 @@ public:
|
||||||
virtual void collectEndogenous(NodeID &Id);
|
virtual void collectEndogenous(NodeID &Id);
|
||||||
static double eval_opcode(double v1, BinaryOpcode op_code, double v2) throw (EvalException);
|
static double eval_opcode(double v1, BinaryOpcode op_code, double v2) throw (EvalException);
|
||||||
virtual double eval(const eval_context_type &eval_context) const throw (EvalException);
|
virtual double eval(const eval_context_type &eval_context) const throw (EvalException);
|
||||||
/*New*/
|
|
||||||
virtual void compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const;
|
virtual void compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const;
|
||||||
/*EndNew*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum TrinaryOpcode
|
enum TrinaryOpcode
|
||||||
|
@ -304,7 +293,6 @@ private:
|
||||||
const TrinaryOpcode op_code;
|
const TrinaryOpcode op_code;
|
||||||
virtual NodeID computeDerivative(int varID);
|
virtual NodeID computeDerivative(int varID);
|
||||||
virtual int cost(const temporary_terms_type &temporary_terms, bool is_matlab) const;
|
virtual int cost(const temporary_terms_type &temporary_terms, bool is_matlab) const;
|
||||||
set<int> non_null_derivatives_tmp;
|
|
||||||
public:
|
public:
|
||||||
TrinaryOpNode(DataTree &datatree_arg, const NodeID arg1_arg,
|
TrinaryOpNode(DataTree &datatree_arg, const NodeID arg1_arg,
|
||||||
TrinaryOpcode op_code_arg, const NodeID arg2_arg, const NodeID arg3_arg);
|
TrinaryOpcode op_code_arg, const NodeID arg2_arg, const NodeID arg3_arg);
|
||||||
|
@ -320,9 +308,7 @@ public:
|
||||||
virtual void collectEndogenous(NodeID &Id);
|
virtual void collectEndogenous(NodeID &Id);
|
||||||
static double eval_opcode(double v1, TrinaryOpcode op_code, double v2, double v3) throw (EvalException);
|
static double eval_opcode(double v1, TrinaryOpcode op_code, double v2, double v3) throw (EvalException);
|
||||||
virtual double eval(const eval_context_type &eval_context) const throw (EvalException);
|
virtual double eval(const eval_context_type &eval_context) const throw (EvalException);
|
||||||
/*New*/
|
|
||||||
virtual void compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const;
|
virtual void compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const;
|
||||||
/*EndNew*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//! Unknown function node
|
//! Unknown function node
|
||||||
|
@ -346,9 +332,7 @@ public:
|
||||||
map_idx_type &map_idx) const;
|
map_idx_type &map_idx) const;
|
||||||
virtual void collectEndogenous(NodeID &Id);
|
virtual void collectEndogenous(NodeID &Id);
|
||||||
virtual double eval(const eval_context_type &eval_context) const throw (EvalException);
|
virtual double eval(const eval_context_type &eval_context) const throw (EvalException);
|
||||||
/*New*/
|
|
||||||
virtual void compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const;
|
virtual void compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const;
|
||||||
/*EndNew*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct IM_compact
|
typedef struct IM_compact
|
||||||
|
|
|
@ -184,8 +184,6 @@ public:
|
||||||
//! Adds a "cutoff" statement
|
//! Adds a "cutoff" statement
|
||||||
void cutoff(string *cutoff);
|
void cutoff(string *cutoff);
|
||||||
//! Adds a weight of the "markowitz" criteria statement
|
//! Adds a weight of the "markowitz" criteria statement
|
||||||
void simulation_method(string *simulation_method);
|
|
||||||
//! Adds a deterministic simulation method statement
|
|
||||||
void markowitz(string *markowitz);
|
void markowitz(string *markowitz);
|
||||||
//! Adds a "dsample" statement
|
//! Adds a "dsample" statement
|
||||||
void dsample(string *arg1);
|
void dsample(string *arg1);
|
||||||
|
|
Loading…
Reference in New Issue