Add const qualifier for tef_terms in writeOutput method and siblings
Consequently, change various function calls where tef_terms was empty, passing an (empty) rvalue instead of an lvalue.issue#70
parent
33b280b3d5
commit
08eedcb448
|
@ -966,7 +966,6 @@ RamseyConstraintsStatement::writeOutput(ostream &output, const string &basename,
|
||||||
void
|
void
|
||||||
RamseyConstraintsStatement::writeJsonOutput(ostream &output) const
|
RamseyConstraintsStatement::writeJsonOutput(ostream &output) const
|
||||||
{
|
{
|
||||||
deriv_node_temp_terms_t tef_terms;
|
|
||||||
output << "{\"statementName\": \"ramsey_constraints\""
|
output << "{\"statementName\": \"ramsey_constraints\""
|
||||||
<< ", \"ramsey_model_constraints\": [" << endl;
|
<< ", \"ramsey_model_constraints\": [" << endl;
|
||||||
for (RamseyConstraintsStatement::constraints_t::const_iterator it = constraints.begin(); it != constraints.end(); ++it)
|
for (RamseyConstraintsStatement::constraints_t::const_iterator it = constraints.begin(); it != constraints.end(); ++it)
|
||||||
|
@ -993,7 +992,7 @@ RamseyConstraintsStatement::writeJsonOutput(ostream &output) const
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
output << " ";
|
output << " ";
|
||||||
it->expression->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->expression->writeJsonOutput(output, {}, {});
|
||||||
output << "\"}" << endl;
|
output << "\"}" << endl;
|
||||||
}
|
}
|
||||||
output << "]" << endl;
|
output << "]" << endl;
|
||||||
|
@ -1570,7 +1569,6 @@ EstimatedParamsStatement::writeOutput(ostream &output, const string &basename, b
|
||||||
void
|
void
|
||||||
EstimatedParamsStatement::writeJsonOutput(ostream &output) const
|
EstimatedParamsStatement::writeJsonOutput(ostream &output) const
|
||||||
{
|
{
|
||||||
deriv_node_temp_terms_t tef_terms;
|
|
||||||
output << "{\"statementName\": \"estimated_params\", "
|
output << "{\"statementName\": \"estimated_params\", "
|
||||||
<< "\"params\": [";
|
<< "\"params\": [";
|
||||||
for (vector<EstimationParams>::const_iterator it = estim_params_list.begin(); it != estim_params_list.end(); it++)
|
for (vector<EstimationParams>::const_iterator it = estim_params_list.begin(); it != estim_params_list.end(); it++)
|
||||||
|
@ -1593,23 +1591,23 @@ EstimatedParamsStatement::writeJsonOutput(ostream &output) const
|
||||||
}
|
}
|
||||||
|
|
||||||
output << ", \"init_val\": \"";
|
output << ", \"init_val\": \"";
|
||||||
it->init_val->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->init_val->writeJsonOutput(output, {}, {});
|
||||||
output << "\", \"lower_bound\": \"";
|
output << "\", \"lower_bound\": \"";
|
||||||
it->low_bound->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->low_bound->writeJsonOutput(output, {}, {});
|
||||||
output << "\", \"upper_bound\": \"";
|
output << "\", \"upper_bound\": \"";
|
||||||
it->up_bound->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->up_bound->writeJsonOutput(output, {}, {});
|
||||||
output << "\", \"prior_distribution\": "
|
output << "\", \"prior_distribution\": "
|
||||||
<< it->prior
|
<< it->prior
|
||||||
<< ", \"mean\": \"";
|
<< ", \"mean\": \"";
|
||||||
it->mean->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->mean->writeJsonOutput(output, {}, {});
|
||||||
output << "\", \"std\": \"";
|
output << "\", \"std\": \"";
|
||||||
it->std->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->std->writeJsonOutput(output, {}, {});
|
||||||
output << "\", \"p3\": \"";
|
output << "\", \"p3\": \"";
|
||||||
it->p3->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->p3->writeJsonOutput(output, {}, {});
|
||||||
output << "\", \"p4\": \"";
|
output << "\", \"p4\": \"";
|
||||||
it->p4->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->p4->writeJsonOutput(output, {}, {});
|
||||||
output << "\", \"jscale\": \"";
|
output << "\", \"jscale\": \"";
|
||||||
it->jscale->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->jscale->writeJsonOutput(output, {}, {});
|
||||||
output << "\"}" << endl;
|
output << "\"}" << endl;
|
||||||
}
|
}
|
||||||
output << "]"
|
output << "]"
|
||||||
|
@ -1692,7 +1690,6 @@ EstimatedParamsInitStatement::writeOutput(ostream &output, const string &basenam
|
||||||
void
|
void
|
||||||
EstimatedParamsInitStatement::writeJsonOutput(ostream &output) const
|
EstimatedParamsInitStatement::writeJsonOutput(ostream &output) const
|
||||||
{
|
{
|
||||||
deriv_node_temp_terms_t tef_terms;
|
|
||||||
output << "{\"statementName\": \"estimated_params_init\"";
|
output << "{\"statementName\": \"estimated_params_init\"";
|
||||||
|
|
||||||
if (use_calibration)
|
if (use_calibration)
|
||||||
|
@ -1718,7 +1715,7 @@ EstimatedParamsInitStatement::writeJsonOutput(ostream &output) const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
output << ", \"init_val\": \"";
|
output << ", \"init_val\": \"";
|
||||||
it->init_val->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->init_val->writeJsonOutput(output, {}, {});
|
||||||
output << "\"}";
|
output << "\"}";
|
||||||
}
|
}
|
||||||
output << "]"
|
output << "]"
|
||||||
|
@ -1814,7 +1811,6 @@ EstimatedParamsBoundsStatement::writeOutput(ostream &output, const string &basen
|
||||||
void
|
void
|
||||||
EstimatedParamsBoundsStatement::writeJsonOutput(ostream &output) const
|
EstimatedParamsBoundsStatement::writeJsonOutput(ostream &output) const
|
||||||
{
|
{
|
||||||
deriv_node_temp_terms_t tef_terms;
|
|
||||||
output << "{\"statementName\": \"estimated_params_bounds\", "
|
output << "{\"statementName\": \"estimated_params_bounds\", "
|
||||||
<< "\"params\": [";
|
<< "\"params\": [";
|
||||||
|
|
||||||
|
@ -1836,9 +1832,9 @@ EstimatedParamsBoundsStatement::writeJsonOutput(ostream &output) const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
output << ", \"lower_bound\": ";
|
output << ", \"lower_bound\": ";
|
||||||
it->low_bound->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->low_bound->writeJsonOutput(output, {}, {});
|
||||||
output << ", \"upper_bound\": ";
|
output << ", \"upper_bound\": ";
|
||||||
it->up_bound->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->up_bound->writeJsonOutput(output, {}, {});
|
||||||
output << "}";
|
output << "}";
|
||||||
}
|
}
|
||||||
output << "]"
|
output << "]"
|
||||||
|
@ -1874,7 +1870,6 @@ ObservationTrendsStatement::writeOutput(ostream &output, const string &basename,
|
||||||
void
|
void
|
||||||
ObservationTrendsStatement::writeJsonOutput(ostream &output) const
|
ObservationTrendsStatement::writeJsonOutput(ostream &output) const
|
||||||
{
|
{
|
||||||
deriv_node_temp_terms_t tef_terms;
|
|
||||||
output << "{\"statementName\": \"observation_trends\", "
|
output << "{\"statementName\": \"observation_trends\", "
|
||||||
<< "\"trends\" : {";
|
<< "\"trends\" : {";
|
||||||
bool printed = false;
|
bool printed = false;
|
||||||
|
@ -1886,7 +1881,7 @@ ObservationTrendsStatement::writeJsonOutput(ostream &output) const
|
||||||
if (printed)
|
if (printed)
|
||||||
output << ", ";
|
output << ", ";
|
||||||
output << "\"" << it->first << "\": \"";
|
output << "\"" << it->first << "\": \"";
|
||||||
it->second->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->second->writeJsonOutput(output, {}, {});
|
||||||
output << "\"" << endl;
|
output << "\"" << endl;
|
||||||
printed = true;
|
printed = true;
|
||||||
}
|
}
|
||||||
|
@ -1977,7 +1972,6 @@ OsrParamsBoundsStatement::writeOutput(ostream &output, const string &basename, b
|
||||||
void
|
void
|
||||||
OsrParamsBoundsStatement::writeJsonOutput(ostream &output) const
|
OsrParamsBoundsStatement::writeJsonOutput(ostream &output) const
|
||||||
{
|
{
|
||||||
deriv_node_temp_terms_t tef_terms;
|
|
||||||
output << "{\"statementName\": \"osr_params_bounds\""
|
output << "{\"statementName\": \"osr_params_bounds\""
|
||||||
<< ", \"bounds\": [";
|
<< ", \"bounds\": [";
|
||||||
for (vector<OsrParams>::const_iterator it = osr_params_list.begin();
|
for (vector<OsrParams>::const_iterator it = osr_params_list.begin();
|
||||||
|
@ -1987,9 +1981,9 @@ OsrParamsBoundsStatement::writeJsonOutput(ostream &output) const
|
||||||
output << ", ";
|
output << ", ";
|
||||||
output << "{\"parameter\": \"" << it->name << "\","
|
output << "{\"parameter\": \"" << it->name << "\","
|
||||||
<< "\"bounds\": [\"";
|
<< "\"bounds\": [\"";
|
||||||
it->low_bound->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->low_bound->writeJsonOutput(output, {}, {});
|
||||||
output << "\", \"";
|
output << "\", \"";
|
||||||
it->up_bound->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->up_bound->writeJsonOutput(output, {}, {});
|
||||||
output << "\"]"
|
output << "\"]"
|
||||||
<< "}";
|
<< "}";
|
||||||
}
|
}
|
||||||
|
@ -2105,7 +2099,6 @@ OptimWeightsStatement::writeOutput(ostream &output, const string &basename, bool
|
||||||
void
|
void
|
||||||
OptimWeightsStatement::writeJsonOutput(ostream &output) const
|
OptimWeightsStatement::writeJsonOutput(ostream &output) const
|
||||||
{
|
{
|
||||||
deriv_node_temp_terms_t tef_terms;
|
|
||||||
output << "{\"statementName\": \"optim_weights\", "
|
output << "{\"statementName\": \"optim_weights\", "
|
||||||
<< "\"weights\": [";
|
<< "\"weights\": [";
|
||||||
for (var_weights_t::const_iterator it = var_weights.begin();
|
for (var_weights_t::const_iterator it = var_weights.begin();
|
||||||
|
@ -2115,7 +2108,7 @@ OptimWeightsStatement::writeJsonOutput(ostream &output) const
|
||||||
output << ", ";
|
output << ", ";
|
||||||
output << "{\"name\": \"" << it->first << "\""
|
output << "{\"name\": \"" << it->first << "\""
|
||||||
<< ", \"value\": \"";
|
<< ", \"value\": \"";
|
||||||
it->second->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->second->writeJsonOutput(output, {}, {});
|
||||||
output << "\"}";
|
output << "\"}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2127,7 +2120,7 @@ OptimWeightsStatement::writeJsonOutput(ostream &output) const
|
||||||
output << "{\"name1\": \"" << it->first.first << "\""
|
output << "{\"name1\": \"" << it->first.first << "\""
|
||||||
<< ", \"name2\": \"" << it->first.second << "\""
|
<< ", \"name2\": \"" << it->first.second << "\""
|
||||||
<< ", \"value\": \"";
|
<< ", \"value\": \"";
|
||||||
it->second->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->second->writeJsonOutput(output, {}, {});
|
||||||
output << "\"}";
|
output << "\"}";
|
||||||
}
|
}
|
||||||
output << "]"
|
output << "]"
|
||||||
|
@ -3998,9 +3991,8 @@ BasicPriorStatement::writeJsonPriorOutput(ostream &output) const
|
||||||
writeJsonShape(output);
|
writeJsonShape(output);
|
||||||
if (variance != NULL)
|
if (variance != NULL)
|
||||||
{
|
{
|
||||||
deriv_node_temp_terms_t tef_terms;
|
|
||||||
output << ", \"variance\": \"";
|
output << ", \"variance\": \"";
|
||||||
variance->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
variance->writeJsonOutput(output, {}, {});
|
||||||
output << "\"";
|
output << "\"";
|
||||||
}
|
}
|
||||||
if (options_list.getNumberOfOptions())
|
if (options_list.getNumberOfOptions())
|
||||||
|
|
|
@ -5895,9 +5895,6 @@ DynamicModel::writeResidualsC(const string &basename, bool cuda) const
|
||||||
mDynamicModelFile << "void Residuals(const double *y, double *x, int nb_row_x, double *params, double *steady_state, int it_, double *residual)" << endl
|
mDynamicModelFile << "void Residuals(const double *y, double *x, int nb_row_x, double *params, double *steady_state, int it_, double *residual)" << endl
|
||||||
<< "{" << endl;
|
<< "{" << endl;
|
||||||
|
|
||||||
// this is always empty here, but needed by d1->writeOutput
|
|
||||||
deriv_node_temp_terms_t tef_terms;
|
|
||||||
|
|
||||||
ostringstream model_output; // Used for storing model equations
|
ostringstream model_output; // Used for storing model equations
|
||||||
writeModelEquations(model_output, oCDynamic2Model);
|
writeModelEquations(model_output, oCDynamic2Model);
|
||||||
|
|
||||||
|
@ -5950,9 +5947,6 @@ DynamicModel::writeFirstDerivativesC(const string &basename, bool cuda) const
|
||||||
mDynamicModelFile << "void FirstDerivatives(const double *y, double *x, int nb_row_x, double *params, double *steady_state, int it_, double *residual, double *g1, double *v2, double *v3)" << endl
|
mDynamicModelFile << "void FirstDerivatives(const double *y, double *x, int nb_row_x, double *params, double *steady_state, int it_, double *residual, double *g1, double *v2, double *v3)" << endl
|
||||||
<< "{" << endl;
|
<< "{" << endl;
|
||||||
|
|
||||||
// this is always empty here, but needed by d1->writeOutput
|
|
||||||
deriv_node_temp_terms_t tef_terms;
|
|
||||||
|
|
||||||
// Writing Jacobian
|
// Writing Jacobian
|
||||||
for (first_derivatives_t::const_iterator it = first_derivatives.begin();
|
for (first_derivatives_t::const_iterator it = first_derivatives.begin();
|
||||||
it != first_derivatives.end(); it++)
|
it != first_derivatives.end(); it++)
|
||||||
|
@ -5965,7 +5959,7 @@ DynamicModel::writeFirstDerivativesC(const string &basename, bool cuda) const
|
||||||
mDynamicModelFile << "=";
|
mDynamicModelFile << "=";
|
||||||
// oCStaticModel makes reference to the static variables
|
// oCStaticModel makes reference to the static variables
|
||||||
// oCDynamicModel makes reference to the dynamic variables
|
// oCDynamicModel makes reference to the dynamic variables
|
||||||
d1->writeOutput(mDynamicModelFile, oCDynamicModel, temporary_terms, {}, tef_terms);
|
d1->writeOutput(mDynamicModelFile, oCDynamicModel, temporary_terms, {}, {});
|
||||||
mDynamicModelFile << ";" << endl;
|
mDynamicModelFile << ";" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6014,8 +6008,6 @@ DynamicModel::writeFirstDerivativesC_csr(const string &basename, bool cuda) cons
|
||||||
<< "{" << endl;
|
<< "{" << endl;
|
||||||
|
|
||||||
int cols_nbr = 3*symbol_table.endo_nbr() + symbol_table.exo_nbr() + symbol_table.exo_det_nbr();
|
int cols_nbr = 3*symbol_table.endo_nbr() + symbol_table.exo_nbr() + symbol_table.exo_det_nbr();
|
||||||
// this is always empty here, but needed by d1->writeOutput
|
|
||||||
deriv_node_temp_terms_t tef_terms;
|
|
||||||
|
|
||||||
// Indexing derivatives in column order
|
// Indexing derivatives in column order
|
||||||
vector<derivative> D;
|
vector<derivative> D;
|
||||||
|
@ -6060,7 +6052,7 @@ DynamicModel::writeFirstDerivativesC_csr(const string &basename, bool cuda) cons
|
||||||
<< "=" << it->col_nbr << ";" << endl;
|
<< "=" << it->col_nbr << ";" << endl;
|
||||||
mDynamicModelFile << "value[" << k << "] = ";
|
mDynamicModelFile << "value[" << k << "] = ";
|
||||||
// oCstaticModel makes reference to the static variables
|
// oCstaticModel makes reference to the static variables
|
||||||
it->value->writeOutput(mDynamicModelFile, oCDynamic2Model, temporary_terms, {}, tef_terms);
|
it->value->writeOutput(mDynamicModelFile, oCDynamic2Model, temporary_terms, {}, {});
|
||||||
mDynamicModelFile << ";" << endl;
|
mDynamicModelFile << ";" << endl;
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
|
@ -6119,9 +6111,6 @@ DynamicModel::writeSecondDerivativesC_csr(const string &basename, bool cuda) con
|
||||||
mDynamicModelFile << "void SecondDerivatives(const double *y, double *x, int nb_row_x, double *params, double *steady_state, int it_, double *residual, int *row_ptr, int *col_ptr, double *value)" << endl
|
mDynamicModelFile << "void SecondDerivatives(const double *y, double *x, int nb_row_x, double *params, double *steady_state, int it_, double *residual, int *row_ptr, int *col_ptr, double *value)" << endl
|
||||||
<< "{" << endl;
|
<< "{" << endl;
|
||||||
|
|
||||||
// this is always empty here, but needed by d1->writeOutput
|
|
||||||
deriv_node_temp_terms_t tef_terms;
|
|
||||||
|
|
||||||
// Indexing derivatives in column order
|
// Indexing derivatives in column order
|
||||||
vector<derivative> D;
|
vector<derivative> D;
|
||||||
int hessianColsNbr = dynJacobianColsNbr*dynJacobianColsNbr;
|
int hessianColsNbr = dynJacobianColsNbr*dynJacobianColsNbr;
|
||||||
|
@ -6159,7 +6148,7 @@ DynamicModel::writeSecondDerivativesC_csr(const string &basename, bool cuda) con
|
||||||
<< "=" << it->col_nbr << ";" << endl;
|
<< "=" << it->col_nbr << ";" << endl;
|
||||||
mDynamicModelFile << "value[" << k << "] = ";
|
mDynamicModelFile << "value[" << k << "] = ";
|
||||||
// oCstaticModel makes reference to the static variables
|
// oCstaticModel makes reference to the static variables
|
||||||
it->value->writeOutput(mDynamicModelFile, oCStaticModel, temporary_terms, {}, tef_terms);
|
it->value->writeOutput(mDynamicModelFile, oCStaticModel, temporary_terms, {}, {});
|
||||||
mDynamicModelFile << ";" << endl;
|
mDynamicModelFile << ";" << endl;
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
|
@ -6218,9 +6207,6 @@ DynamicModel::writeThirdDerivativesC_csr(const string &basename, bool cuda) cons
|
||||||
mDynamicModelFile << "void ThirdDerivatives(const double *y, double *x, int nb_row_x, double *params, double *steady_state, int it_, double *residual, double *g1, double *v2, double *v3)" << endl
|
mDynamicModelFile << "void ThirdDerivatives(const double *y, double *x, int nb_row_x, double *params, double *steady_state, int it_, double *residual, double *g1, double *v2, double *v3)" << endl
|
||||||
<< "{" << endl;
|
<< "{" << endl;
|
||||||
|
|
||||||
// this is always empty here, but needed by d1->writeOutput
|
|
||||||
deriv_node_temp_terms_t tef_terms;
|
|
||||||
|
|
||||||
vector<derivative> D;
|
vector<derivative> D;
|
||||||
int hessianColsNbr = dynJacobianColsNbr*dynJacobianColsNbr;
|
int hessianColsNbr = dynJacobianColsNbr*dynJacobianColsNbr;
|
||||||
int thirdDerivativesColsNbr = hessianColsNbr*dynJacobianColsNbr;
|
int thirdDerivativesColsNbr = hessianColsNbr*dynJacobianColsNbr;
|
||||||
|
@ -6291,7 +6277,7 @@ DynamicModel::writeThirdDerivativesC_csr(const string &basename, bool cuda) cons
|
||||||
<< "=" << it->col_nbr << ";" << endl;
|
<< "=" << it->col_nbr << ";" << endl;
|
||||||
mDynamicModelFile << "value[" << k << "] = ";
|
mDynamicModelFile << "value[" << k << "] = ";
|
||||||
// oCstaticModel makes reference to the static variables
|
// oCstaticModel makes reference to the static variables
|
||||||
it->value->writeOutput(mDynamicModelFile, oCStaticModel, temporary_terms, {}, tef_terms);
|
it->value->writeOutput(mDynamicModelFile, oCStaticModel, temporary_terms, {}, {});
|
||||||
mDynamicModelFile << ";" << endl;
|
mDynamicModelFile << ";" << endl;
|
||||||
k++;
|
k++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,8 +197,7 @@ ExprNode::writeOutput(ostream &output, ExprNodeOutputType output_type) const
|
||||||
void
|
void
|
||||||
ExprNode::writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs) const
|
ExprNode::writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs) const
|
||||||
{
|
{
|
||||||
deriv_node_temp_terms_t tef_terms;
|
writeOutput(output, output_type, temporary_terms, temporary_terms_idxs, {});
|
||||||
writeOutput(output, output_type, temporary_terms, temporary_terms_idxs, tef_terms);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -206,8 +205,7 @@ ExprNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
||||||
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
||||||
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic) const
|
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic) const
|
||||||
{
|
{
|
||||||
deriv_node_temp_terms_t tef_terms;
|
compile(CompileCode, instruction_number, lhs_rhs, temporary_terms, map_idx, dynamic, steady_dynamic, {});
|
||||||
compile(CompileCode, instruction_number, lhs_rhs, temporary_terms, map_idx, dynamic, steady_dynamic, tef_terms);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -371,7 +369,7 @@ void
|
||||||
NumConstNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
NumConstNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
const temporary_terms_idxs_t &temporary_terms_idxs,
|
const temporary_terms_idxs_t &temporary_terms_idxs,
|
||||||
deriv_node_temp_terms_t &tef_terms) const
|
const deriv_node_temp_terms_t &tef_terms) const
|
||||||
{
|
{
|
||||||
if (!checkIfTemporaryTermThenWrite(output, output_type, temporary_terms, temporary_terms_idxs))
|
if (!checkIfTemporaryTermThenWrite(output, output_type, temporary_terms, temporary_terms_idxs))
|
||||||
output << datatree.num_constants.get(id);
|
output << datatree.num_constants.get(id);
|
||||||
|
@ -380,7 +378,7 @@ NumConstNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
void
|
void
|
||||||
NumConstNode::writeJsonOutput(ostream &output,
|
NumConstNode::writeJsonOutput(ostream &output,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
deriv_node_temp_terms_t &tef_terms,
|
const deriv_node_temp_terms_t &tef_terms,
|
||||||
const bool isdynamic) const
|
const bool isdynamic) const
|
||||||
{
|
{
|
||||||
output << datatree.num_constants.get(id);
|
output << datatree.num_constants.get(id);
|
||||||
|
@ -402,7 +400,7 @@ void
|
||||||
NumConstNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
NumConstNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
||||||
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
||||||
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
||||||
deriv_node_temp_terms_t &tef_terms) const
|
const deriv_node_temp_terms_t &tef_terms) const
|
||||||
{
|
{
|
||||||
FLDC_ fldc(datatree.num_constants.getDouble(id));
|
FLDC_ fldc(datatree.num_constants.getDouble(id));
|
||||||
fldc.write(CompileCode, instruction_number);
|
fldc.write(CompileCode, instruction_number);
|
||||||
|
@ -771,7 +769,7 @@ VariableNode::containsExternalFunction() const
|
||||||
void
|
void
|
||||||
VariableNode::writeJsonOutput(ostream &output,
|
VariableNode::writeJsonOutput(ostream &output,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
deriv_node_temp_terms_t &tef_terms,
|
const deriv_node_temp_terms_t &tef_terms,
|
||||||
const bool isdynamic) const
|
const bool isdynamic) const
|
||||||
{
|
{
|
||||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<VariableNode *>(this));
|
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<VariableNode *>(this));
|
||||||
|
@ -790,7 +788,7 @@ void
|
||||||
VariableNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
VariableNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
const temporary_terms_idxs_t &temporary_terms_idxs,
|
const temporary_terms_idxs_t &temporary_terms_idxs,
|
||||||
deriv_node_temp_terms_t &tef_terms) const
|
const deriv_node_temp_terms_t &tef_terms) const
|
||||||
{
|
{
|
||||||
if (checkIfTemporaryTermThenWrite(output, output_type, temporary_terms, temporary_terms_idxs))
|
if (checkIfTemporaryTermThenWrite(output, output_type, temporary_terms, temporary_terms_idxs))
|
||||||
return;
|
return;
|
||||||
|
@ -1059,7 +1057,7 @@ void
|
||||||
VariableNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
VariableNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
||||||
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
||||||
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
||||||
deriv_node_temp_terms_t &tef_terms) const
|
const deriv_node_temp_terms_t &tef_terms) const
|
||||||
{
|
{
|
||||||
if (type == eModelLocalVariable || type == eModFileLocalVariable)
|
if (type == eModelLocalVariable || type == eModFileLocalVariable)
|
||||||
datatree.local_variables_table[symb_id]->compile(CompileCode, instruction_number, lhs_rhs, temporary_terms, map_idx, dynamic, steady_dynamic, tef_terms);
|
datatree.local_variables_table[symb_id]->compile(CompileCode, instruction_number, lhs_rhs, temporary_terms, map_idx, dynamic, steady_dynamic, tef_terms);
|
||||||
|
@ -2189,7 +2187,7 @@ UnaryOpNode::containsExternalFunction() const
|
||||||
void
|
void
|
||||||
UnaryOpNode::writeJsonOutput(ostream &output,
|
UnaryOpNode::writeJsonOutput(ostream &output,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
deriv_node_temp_terms_t &tef_terms,
|
const deriv_node_temp_terms_t &tef_terms,
|
||||||
const bool isdynamic) const
|
const bool isdynamic) const
|
||||||
{
|
{
|
||||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<UnaryOpNode *>(this));
|
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<UnaryOpNode *>(this));
|
||||||
|
@ -2344,7 +2342,7 @@ void
|
||||||
UnaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
UnaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
const temporary_terms_idxs_t &temporary_terms_idxs,
|
const temporary_terms_idxs_t &temporary_terms_idxs,
|
||||||
deriv_node_temp_terms_t &tef_terms) const
|
const deriv_node_temp_terms_t &tef_terms) const
|
||||||
{
|
{
|
||||||
if (checkIfTemporaryTermThenWrite(output, output_type, temporary_terms, temporary_terms_idxs))
|
if (checkIfTemporaryTermThenWrite(output, output_type, temporary_terms, temporary_terms_idxs))
|
||||||
return;
|
return;
|
||||||
|
@ -2629,7 +2627,7 @@ void
|
||||||
UnaryOpNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
UnaryOpNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
||||||
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
||||||
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
||||||
deriv_node_temp_terms_t &tef_terms) const
|
const deriv_node_temp_terms_t &tef_terms) const
|
||||||
{
|
{
|
||||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<UnaryOpNode *>(this));
|
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<UnaryOpNode *>(this));
|
||||||
if (it != temporary_terms.end())
|
if (it != temporary_terms.end())
|
||||||
|
@ -3898,7 +3896,7 @@ void
|
||||||
BinaryOpNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
BinaryOpNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
||||||
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
||||||
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
||||||
deriv_node_temp_terms_t &tef_terms) const
|
const deriv_node_temp_terms_t &tef_terms) const
|
||||||
{
|
{
|
||||||
// If current node is a temporary term
|
// If current node is a temporary term
|
||||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<BinaryOpNode *>(this));
|
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<BinaryOpNode *>(this));
|
||||||
|
@ -3952,7 +3950,7 @@ BinaryOpNode::containsExternalFunction() const
|
||||||
void
|
void
|
||||||
BinaryOpNode::writeJsonOutput(ostream &output,
|
BinaryOpNode::writeJsonOutput(ostream &output,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
deriv_node_temp_terms_t &tef_terms,
|
const deriv_node_temp_terms_t &tef_terms,
|
||||||
const bool isdynamic) const
|
const bool isdynamic) const
|
||||||
{
|
{
|
||||||
// If current node is a temporary term
|
// If current node is a temporary term
|
||||||
|
@ -4085,7 +4083,7 @@ void
|
||||||
BinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
BinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
const temporary_terms_idxs_t &temporary_terms_idxs,
|
const temporary_terms_idxs_t &temporary_terms_idxs,
|
||||||
deriv_node_temp_terms_t &tef_terms) const
|
const deriv_node_temp_terms_t &tef_terms) const
|
||||||
{
|
{
|
||||||
if (checkIfTemporaryTermThenWrite(output, output_type, temporary_terms, temporary_terms_idxs))
|
if (checkIfTemporaryTermThenWrite(output, output_type, temporary_terms, temporary_terms_idxs))
|
||||||
return;
|
return;
|
||||||
|
@ -5345,7 +5343,7 @@ void
|
||||||
TrinaryOpNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
TrinaryOpNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
||||||
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
||||||
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
||||||
deriv_node_temp_terms_t &tef_terms) const
|
const deriv_node_temp_terms_t &tef_terms) const
|
||||||
{
|
{
|
||||||
// If current node is a temporary term
|
// If current node is a temporary term
|
||||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<TrinaryOpNode *>(this));
|
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<TrinaryOpNode *>(this));
|
||||||
|
@ -5397,7 +5395,7 @@ TrinaryOpNode::containsExternalFunction() const
|
||||||
void
|
void
|
||||||
TrinaryOpNode::writeJsonOutput(ostream &output,
|
TrinaryOpNode::writeJsonOutput(ostream &output,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
deriv_node_temp_terms_t &tef_terms,
|
const deriv_node_temp_terms_t &tef_terms,
|
||||||
const bool isdynamic) const
|
const bool isdynamic) const
|
||||||
{
|
{
|
||||||
// If current node is a temporary term
|
// If current node is a temporary term
|
||||||
|
@ -5430,7 +5428,7 @@ void
|
||||||
TrinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
TrinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
const temporary_terms_idxs_t &temporary_terms_idxs,
|
const temporary_terms_idxs_t &temporary_terms_idxs,
|
||||||
deriv_node_temp_terms_t &tef_terms) const
|
const deriv_node_temp_terms_t &tef_terms) const
|
||||||
{
|
{
|
||||||
if (checkIfTemporaryTermThenWrite(output, output_type, temporary_terms, temporary_terms_idxs))
|
if (checkIfTemporaryTermThenWrite(output, output_type, temporary_terms, temporary_terms_idxs))
|
||||||
return;
|
return;
|
||||||
|
@ -5968,7 +5966,7 @@ unsigned int
|
||||||
AbstractExternalFunctionNode::compileExternalFunctionArguments(ostream &CompileCode, unsigned int &instruction_number,
|
AbstractExternalFunctionNode::compileExternalFunctionArguments(ostream &CompileCode, unsigned int &instruction_number,
|
||||||
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
||||||
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
||||||
deriv_node_temp_terms_t &tef_terms) const
|
const deriv_node_temp_terms_t &tef_terms) const
|
||||||
{
|
{
|
||||||
for (vector<expr_t>::const_iterator it = arguments.begin();
|
for (vector<expr_t>::const_iterator it = arguments.begin();
|
||||||
it != arguments.end(); it++)
|
it != arguments.end(); it++)
|
||||||
|
@ -6227,7 +6225,7 @@ AbstractExternalFunctionNode::differentiateForwardVars(const vector<string> &sub
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
AbstractExternalFunctionNode::alreadyWrittenAsTefTerm(int the_symb_id, deriv_node_temp_terms_t &tef_terms) const
|
AbstractExternalFunctionNode::alreadyWrittenAsTefTerm(int the_symb_id, const deriv_node_temp_terms_t &tef_terms) const
|
||||||
{
|
{
|
||||||
deriv_node_temp_terms_t::const_iterator it = tef_terms.find(make_pair(the_symb_id, arguments));
|
deriv_node_temp_terms_t::const_iterator it = tef_terms.find(make_pair(the_symb_id, arguments));
|
||||||
if (it != tef_terms.end())
|
if (it != tef_terms.end())
|
||||||
|
@ -6236,7 +6234,7 @@ AbstractExternalFunctionNode::alreadyWrittenAsTefTerm(int the_symb_id, deriv_nod
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
AbstractExternalFunctionNode::getIndxInTefTerms(int the_symb_id, deriv_node_temp_terms_t &tef_terms) const throw (UnknownFunctionNameAndArgs)
|
AbstractExternalFunctionNode::getIndxInTefTerms(int the_symb_id, const deriv_node_temp_terms_t &tef_terms) const throw (UnknownFunctionNameAndArgs)
|
||||||
{
|
{
|
||||||
deriv_node_temp_terms_t::const_iterator it = tef_terms.find(make_pair(the_symb_id, arguments));
|
deriv_node_temp_terms_t::const_iterator it = tef_terms.find(make_pair(the_symb_id, arguments));
|
||||||
if (it != tef_terms.end())
|
if (it != tef_terms.end())
|
||||||
|
@ -6378,7 +6376,7 @@ void
|
||||||
AbstractExternalFunctionNode::writeExternalFunctionArguments(ostream &output, ExprNodeOutputType output_type,
|
AbstractExternalFunctionNode::writeExternalFunctionArguments(ostream &output, ExprNodeOutputType output_type,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
const temporary_terms_idxs_t &temporary_terms_idxs,
|
const temporary_terms_idxs_t &temporary_terms_idxs,
|
||||||
deriv_node_temp_terms_t &tef_terms) const
|
const deriv_node_temp_terms_t &tef_terms) const
|
||||||
{
|
{
|
||||||
for (vector<expr_t>::const_iterator it = arguments.begin();
|
for (vector<expr_t>::const_iterator it = arguments.begin();
|
||||||
it != arguments.end(); it++)
|
it != arguments.end(); it++)
|
||||||
|
@ -6393,7 +6391,7 @@ AbstractExternalFunctionNode::writeExternalFunctionArguments(ostream &output, Ex
|
||||||
void
|
void
|
||||||
AbstractExternalFunctionNode::writeJsonExternalFunctionArguments(ostream &output,
|
AbstractExternalFunctionNode::writeJsonExternalFunctionArguments(ostream &output,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
deriv_node_temp_terms_t &tef_terms,
|
const deriv_node_temp_terms_t &tef_terms,
|
||||||
const bool isdynamic) const
|
const bool isdynamic) const
|
||||||
{
|
{
|
||||||
for (vector<expr_t>::const_iterator it = arguments.begin();
|
for (vector<expr_t>::const_iterator it = arguments.begin();
|
||||||
|
@ -6410,7 +6408,7 @@ void
|
||||||
AbstractExternalFunctionNode::writePrhs(ostream &output, ExprNodeOutputType output_type,
|
AbstractExternalFunctionNode::writePrhs(ostream &output, ExprNodeOutputType output_type,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
const temporary_terms_idxs_t &temporary_terms_idxs,
|
const temporary_terms_idxs_t &temporary_terms_idxs,
|
||||||
deriv_node_temp_terms_t &tef_terms, const string &ending) const
|
const deriv_node_temp_terms_t &tef_terms, const string &ending) const
|
||||||
{
|
{
|
||||||
output << "mxArray *prhs"<< ending << "[nrhs"<< ending << "];" << endl;
|
output << "mxArray *prhs"<< ending << "[nrhs"<< ending << "];" << endl;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -6487,7 +6485,7 @@ void
|
||||||
ExternalFunctionNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
ExternalFunctionNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
||||||
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
||||||
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
||||||
deriv_node_temp_terms_t &tef_terms) const
|
const deriv_node_temp_terms_t &tef_terms) const
|
||||||
{
|
{
|
||||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<ExternalFunctionNode *>(this));
|
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<ExternalFunctionNode *>(this));
|
||||||
if (it != temporary_terms.end())
|
if (it != temporary_terms.end())
|
||||||
|
@ -6573,7 +6571,7 @@ ExternalFunctionNode::compileExternalFunctionOutput(ostream &CompileCode, unsign
|
||||||
void
|
void
|
||||||
ExternalFunctionNode::writeJsonOutput(ostream &output,
|
ExternalFunctionNode::writeJsonOutput(ostream &output,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
deriv_node_temp_terms_t &tef_terms,
|
const deriv_node_temp_terms_t &tef_terms,
|
||||||
const bool isdynamic) const
|
const bool isdynamic) const
|
||||||
{
|
{
|
||||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<ExternalFunctionNode *>(this));
|
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<ExternalFunctionNode *>(this));
|
||||||
|
@ -6592,7 +6590,7 @@ void
|
||||||
ExternalFunctionNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
ExternalFunctionNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
const temporary_terms_idxs_t &temporary_terms_idxs,
|
const temporary_terms_idxs_t &temporary_terms_idxs,
|
||||||
deriv_node_temp_terms_t &tef_terms) const
|
const deriv_node_temp_terms_t &tef_terms) const
|
||||||
{
|
{
|
||||||
if (output_type == oMatlabOutsideModel || output_type == oSteadyStateFile
|
if (output_type == oMatlabOutsideModel || output_type == oSteadyStateFile
|
||||||
|| output_type == oCSteadyStateFile || output_type == oJuliaSteadyStateFile
|
|| output_type == oCSteadyStateFile || output_type == oJuliaSteadyStateFile
|
||||||
|
@ -6813,7 +6811,7 @@ FirstDerivExternalFunctionNode::composeDerivatives(const vector<expr_t> &dargs)
|
||||||
void
|
void
|
||||||
FirstDerivExternalFunctionNode::writeJsonOutput(ostream &output,
|
FirstDerivExternalFunctionNode::writeJsonOutput(ostream &output,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
deriv_node_temp_terms_t &tef_terms,
|
const deriv_node_temp_terms_t &tef_terms,
|
||||||
const bool isdynamic) const
|
const bool isdynamic) const
|
||||||
{
|
{
|
||||||
// If current node is a temporary term
|
// If current node is a temporary term
|
||||||
|
@ -6843,7 +6841,7 @@ void
|
||||||
FirstDerivExternalFunctionNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
FirstDerivExternalFunctionNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
const temporary_terms_idxs_t &temporary_terms_idxs,
|
const temporary_terms_idxs_t &temporary_terms_idxs,
|
||||||
deriv_node_temp_terms_t &tef_terms) const
|
const deriv_node_temp_terms_t &tef_terms) const
|
||||||
{
|
{
|
||||||
assert(output_type != oMatlabOutsideModel);
|
assert(output_type != oMatlabOutsideModel);
|
||||||
|
|
||||||
|
@ -6882,7 +6880,7 @@ void
|
||||||
FirstDerivExternalFunctionNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
FirstDerivExternalFunctionNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
||||||
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
||||||
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
||||||
deriv_node_temp_terms_t &tef_terms) const
|
const deriv_node_temp_terms_t &tef_terms) const
|
||||||
{
|
{
|
||||||
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<FirstDerivExternalFunctionNode *>(this));
|
temporary_terms_t::const_iterator it = temporary_terms.find(const_cast<FirstDerivExternalFunctionNode *>(this));
|
||||||
if (it != temporary_terms.end())
|
if (it != temporary_terms.end())
|
||||||
|
@ -7190,7 +7188,7 @@ SecondDerivExternalFunctionNode::composeDerivatives(const vector<expr_t> &dargs)
|
||||||
void
|
void
|
||||||
SecondDerivExternalFunctionNode::writeJsonOutput(ostream &output,
|
SecondDerivExternalFunctionNode::writeJsonOutput(ostream &output,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
deriv_node_temp_terms_t &tef_terms,
|
const deriv_node_temp_terms_t &tef_terms,
|
||||||
const bool isdynamic) const
|
const bool isdynamic) const
|
||||||
{
|
{
|
||||||
// If current node is a temporary term
|
// If current node is a temporary term
|
||||||
|
@ -7221,7 +7219,7 @@ void
|
||||||
SecondDerivExternalFunctionNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
SecondDerivExternalFunctionNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
const temporary_terms_idxs_t &temporary_terms_idxs,
|
const temporary_terms_idxs_t &temporary_terms_idxs,
|
||||||
deriv_node_temp_terms_t &tef_terms) const
|
const deriv_node_temp_terms_t &tef_terms) const
|
||||||
{
|
{
|
||||||
assert(output_type != oMatlabOutsideModel);
|
assert(output_type != oMatlabOutsideModel);
|
||||||
|
|
||||||
|
@ -7459,7 +7457,7 @@ void
|
||||||
SecondDerivExternalFunctionNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
SecondDerivExternalFunctionNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
||||||
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
||||||
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
||||||
deriv_node_temp_terms_t &tef_terms) const
|
const deriv_node_temp_terms_t &tef_terms) const
|
||||||
{
|
{
|
||||||
cerr << "SecondDerivExternalFunctionNode::compile: not implemented." << endl;
|
cerr << "SecondDerivExternalFunctionNode::compile: not implemented." << endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
@ -7526,7 +7524,7 @@ void
|
||||||
VarExpectationNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
VarExpectationNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
const temporary_terms_idxs_t &temporary_terms_idxs,
|
const temporary_terms_idxs_t &temporary_terms_idxs,
|
||||||
deriv_node_temp_terms_t &tef_terms) const
|
const deriv_node_temp_terms_t &tef_terms) const
|
||||||
{
|
{
|
||||||
assert(output_type != oMatlabOutsideModel);
|
assert(output_type != oMatlabOutsideModel);
|
||||||
|
|
||||||
|
@ -7677,7 +7675,7 @@ void
|
||||||
VarExpectationNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
VarExpectationNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
||||||
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
||||||
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
||||||
deriv_node_temp_terms_t &tef_terms) const
|
const deriv_node_temp_terms_t &tef_terms) const
|
||||||
{
|
{
|
||||||
cerr << "VarExpectationNode::compile not implemented." << endl;
|
cerr << "VarExpectationNode::compile not implemented." << endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
@ -7845,7 +7843,7 @@ VarExpectationNode::substituteStaticAuxiliaryVariable() const
|
||||||
void
|
void
|
||||||
VarExpectationNode::writeJsonOutput(ostream &output,
|
VarExpectationNode::writeJsonOutput(ostream &output,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
deriv_node_temp_terms_t &tef_terms,
|
const deriv_node_temp_terms_t &tef_terms,
|
||||||
const bool isdynamic) const
|
const bool isdynamic) const
|
||||||
{
|
{
|
||||||
output << "var_expectation("
|
output << "var_expectation("
|
||||||
|
@ -7902,7 +7900,7 @@ void
|
||||||
PacExpectationNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
PacExpectationNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
const temporary_terms_idxs_t &temporary_terms_idxs,
|
const temporary_terms_idxs_t &temporary_terms_idxs,
|
||||||
deriv_node_temp_terms_t &tef_terms) const
|
const deriv_node_temp_terms_t &tef_terms) const
|
||||||
{
|
{
|
||||||
assert(output_type != oMatlabOutsideModel);
|
assert(output_type != oMatlabOutsideModel);
|
||||||
|
|
||||||
|
@ -8105,7 +8103,7 @@ void
|
||||||
PacExpectationNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
PacExpectationNode::compile(ostream &CompileCode, unsigned int &instruction_number,
|
||||||
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
||||||
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
||||||
deriv_node_temp_terms_t &tef_terms) const
|
const deriv_node_temp_terms_t &tef_terms) const
|
||||||
{
|
{
|
||||||
cerr << "PacExpectationNode::compile not implemented." << endl;
|
cerr << "PacExpectationNode::compile not implemented." << endl;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
@ -8257,7 +8255,7 @@ PacExpectationNode::substituteStaticAuxiliaryVariable() const
|
||||||
void
|
void
|
||||||
PacExpectationNode::writeJsonOutput(ostream &output,
|
PacExpectationNode::writeJsonOutput(ostream &output,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
deriv_node_temp_terms_t &tef_terms,
|
const deriv_node_temp_terms_t &tef_terms,
|
||||||
const bool isdynamic) const
|
const bool isdynamic) const
|
||||||
{
|
{
|
||||||
output << "pac_expectation("
|
output << "pac_expectation("
|
||||||
|
|
|
@ -229,9 +229,9 @@ class ExprNode
|
||||||
\param[in] a map from temporary_terms to integers indexes (in the
|
\param[in] a map from temporary_terms to integers indexes (in the
|
||||||
MATLAB or Julia vector of temporary terms); can be empty
|
MATLAB or Julia vector of temporary terms); can be empty
|
||||||
when writing C or MATLAB with block decomposition)
|
when writing C or MATLAB with block decomposition)
|
||||||
\param[in,out] tef_terms the set of already written external function nodes
|
\param[in] tef_terms the set of already written external function nodes
|
||||||
*/
|
*/
|
||||||
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, deriv_node_temp_terms_t &tef_terms) const = 0;
|
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, const deriv_node_temp_terms_t &tef_terms) const = 0;
|
||||||
|
|
||||||
//! returns true if the expr node contains an external function
|
//! returns true if the expr node contains an external function
|
||||||
virtual bool containsExternalFunction() const = 0;
|
virtual bool containsExternalFunction() const = 0;
|
||||||
|
@ -246,7 +246,7 @@ class ExprNode
|
||||||
void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs) const;
|
void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs) const;
|
||||||
|
|
||||||
//! Writes output of node in JSON syntax
|
//! Writes output of node in JSON syntax
|
||||||
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms, const bool isdynamic = true) const = 0;
|
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, const deriv_node_temp_terms_t &tef_terms, const bool isdynamic = true) const = 0;
|
||||||
|
|
||||||
virtual int precedenceJson(const temporary_terms_t &temporary_terms) const;
|
virtual int precedenceJson(const temporary_terms_t &temporary_terms) const;
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ class ExprNode
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException) = 0;
|
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException) = 0;
|
||||||
virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, deriv_node_temp_terms_t &tef_terms) const = 0;
|
virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, const deriv_node_temp_terms_t &tef_terms) const = 0;
|
||||||
void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic) const;
|
void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic) const;
|
||||||
//! Creates a static version of this node
|
//! Creates a static version of this node
|
||||||
/*!
|
/*!
|
||||||
|
@ -570,14 +570,14 @@ public:
|
||||||
return id;
|
return id;
|
||||||
};
|
};
|
||||||
virtual void prepareForDerivation();
|
virtual void prepareForDerivation();
|
||||||
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, deriv_node_temp_terms_t &tef_terms) const;
|
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, const deriv_node_temp_terms_t &tef_terms) const;
|
||||||
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
|
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, const deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
|
||||||
virtual bool containsExternalFunction() const;
|
virtual bool containsExternalFunction() const;
|
||||||
virtual void collectVARLHSVariable(set<expr_t> &result) const;
|
virtual void collectVARLHSVariable(set<expr_t> &result) const;
|
||||||
virtual void collectDynamicVariables(SymbolType type_arg, set<pair<int, int> > &result) const;
|
virtual void collectDynamicVariables(SymbolType type_arg, set<pair<int, int> > &result) const;
|
||||||
virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const;
|
virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const;
|
||||||
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException);
|
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException);
|
||||||
virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, deriv_node_temp_terms_t &tef_terms) const;
|
virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, const deriv_node_temp_terms_t &tef_terms) const;
|
||||||
virtual expr_t toStatic(DataTree &static_datatree) const;
|
virtual expr_t toStatic(DataTree &static_datatree) const;
|
||||||
virtual void computeXrefs(EquationInfo &ei) const;
|
virtual void computeXrefs(EquationInfo &ei) const;
|
||||||
virtual pair<int, expr_t> normalizeEquation(int symb_id_endo, vector<pair<int, pair<expr_t, expr_t> > > &List_of_Op_RHS) const;
|
virtual pair<int, expr_t> normalizeEquation(int symb_id_endo, vector<pair<int, pair<expr_t, expr_t> > > &List_of_Op_RHS) const;
|
||||||
|
@ -637,8 +637,8 @@ private:
|
||||||
public:
|
public:
|
||||||
VariableNode(DataTree &datatree_arg, int symb_id_arg, int lag_arg);
|
VariableNode(DataTree &datatree_arg, int symb_id_arg, int lag_arg);
|
||||||
virtual void prepareForDerivation();
|
virtual void prepareForDerivation();
|
||||||
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, deriv_node_temp_terms_t &tef_terms) const;
|
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, const deriv_node_temp_terms_t &tef_terms) const;
|
||||||
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
|
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, const deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
|
||||||
virtual bool containsExternalFunction() const;
|
virtual bool containsExternalFunction() const;
|
||||||
virtual void collectVARLHSVariable(set<expr_t> &result) const;
|
virtual void collectVARLHSVariable(set<expr_t> &result) const;
|
||||||
virtual void collectDynamicVariables(SymbolType type_arg, set<pair<int, int> > &result) const;
|
virtual void collectDynamicVariables(SymbolType type_arg, set<pair<int, int> > &result) const;
|
||||||
|
@ -650,7 +650,7 @@ public:
|
||||||
int equation) const;
|
int equation) const;
|
||||||
virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const;
|
virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const;
|
||||||
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException);
|
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException);
|
||||||
virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, deriv_node_temp_terms_t &tef_terms) const;
|
virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, const deriv_node_temp_terms_t &tef_terms) const;
|
||||||
virtual expr_t toStatic(DataTree &static_datatree) const;
|
virtual expr_t toStatic(DataTree &static_datatree) const;
|
||||||
virtual void computeXrefs(EquationInfo &ei) const;
|
virtual void computeXrefs(EquationInfo &ei) const;
|
||||||
SymbolType
|
SymbolType
|
||||||
|
@ -736,8 +736,8 @@ public:
|
||||||
virtual void computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReference> > &reference_count,
|
virtual void computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReference> > &reference_count,
|
||||||
map<NodeTreeReference, temporary_terms_t> &temp_terms_map,
|
map<NodeTreeReference, temporary_terms_t> &temp_terms_map,
|
||||||
bool is_matlab, NodeTreeReference tr) const;
|
bool is_matlab, NodeTreeReference tr) const;
|
||||||
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, deriv_node_temp_terms_t &tef_terms) const;
|
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, const deriv_node_temp_terms_t &tef_terms) const;
|
||||||
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
|
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, const deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
|
||||||
virtual bool containsExternalFunction() const;
|
virtual bool containsExternalFunction() const;
|
||||||
virtual void writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output_type,
|
virtual void writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
|
@ -762,7 +762,7 @@ public:
|
||||||
virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const;
|
virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const;
|
||||||
static double eval_opcode(UnaryOpcode op_code, double v) throw (EvalException, EvalExternalFunctionException);
|
static double eval_opcode(UnaryOpcode op_code, double v) throw (EvalException, EvalExternalFunctionException);
|
||||||
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException);
|
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException);
|
||||||
virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, deriv_node_temp_terms_t &tef_terms) const;
|
virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, const deriv_node_temp_terms_t &tef_terms) const;
|
||||||
//! Returns operand
|
//! Returns operand
|
||||||
expr_t
|
expr_t
|
||||||
get_arg() const
|
get_arg() const
|
||||||
|
@ -849,8 +849,8 @@ public:
|
||||||
virtual void computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReference> > &reference_count,
|
virtual void computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReference> > &reference_count,
|
||||||
map<NodeTreeReference, temporary_terms_t> &temp_terms_map,
|
map<NodeTreeReference, temporary_terms_t> &temp_terms_map,
|
||||||
bool is_matlab, NodeTreeReference tr) const;
|
bool is_matlab, NodeTreeReference tr) const;
|
||||||
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, deriv_node_temp_terms_t &tef_terms) const;
|
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, const deriv_node_temp_terms_t &tef_terms) const;
|
||||||
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
|
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, const deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
|
||||||
virtual bool containsExternalFunction() const;
|
virtual bool containsExternalFunction() const;
|
||||||
virtual void writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output_type,
|
virtual void writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
|
@ -875,7 +875,7 @@ public:
|
||||||
virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const;
|
virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const;
|
||||||
static double eval_opcode(double v1, BinaryOpcode op_code, double v2, int derivOrder) throw (EvalException, EvalExternalFunctionException);
|
static double eval_opcode(double v1, BinaryOpcode op_code, double v2, int derivOrder) throw (EvalException, EvalExternalFunctionException);
|
||||||
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException);
|
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException);
|
||||||
virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, deriv_node_temp_terms_t &tef_terms) const;
|
virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, const deriv_node_temp_terms_t &tef_terms) const;
|
||||||
virtual expr_t Compute_RHS(expr_t arg1, expr_t arg2, int op, int op_type) const;
|
virtual expr_t Compute_RHS(expr_t arg1, expr_t arg2, int op, int op_type) const;
|
||||||
//! Returns first operand
|
//! Returns first operand
|
||||||
expr_t
|
expr_t
|
||||||
|
@ -981,8 +981,8 @@ public:
|
||||||
virtual void computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReference> > &reference_count,
|
virtual void computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReference> > &reference_count,
|
||||||
map<NodeTreeReference, temporary_terms_t> &temp_terms_map,
|
map<NodeTreeReference, temporary_terms_t> &temp_terms_map,
|
||||||
bool is_matlab, NodeTreeReference tr) const;
|
bool is_matlab, NodeTreeReference tr) const;
|
||||||
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, deriv_node_temp_terms_t &tef_terms) const;
|
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, const deriv_node_temp_terms_t &tef_terms) const;
|
||||||
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
|
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, const deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
|
||||||
virtual bool containsExternalFunction() const;
|
virtual bool containsExternalFunction() const;
|
||||||
virtual void writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output_type,
|
virtual void writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
|
@ -1007,7 +1007,7 @@ public:
|
||||||
virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const;
|
virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const;
|
||||||
static double eval_opcode(double v1, TrinaryOpcode op_code, double v2, double v3) throw (EvalException, EvalExternalFunctionException);
|
static double eval_opcode(double v1, TrinaryOpcode op_code, double v2, double v3) throw (EvalException, EvalExternalFunctionException);
|
||||||
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException);
|
virtual double eval(const eval_context_t &eval_context) const throw (EvalException, EvalExternalFunctionException);
|
||||||
virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, deriv_node_temp_terms_t &tef_terms) const;
|
virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, const deriv_node_temp_terms_t &tef_terms) const;
|
||||||
virtual expr_t toStatic(DataTree &static_datatree) const;
|
virtual expr_t toStatic(DataTree &static_datatree) const;
|
||||||
virtual void computeXrefs(EquationInfo &ei) const;
|
virtual void computeXrefs(EquationInfo &ei) const;
|
||||||
virtual pair<int, expr_t> normalizeEquation(int symb_id_endo, vector<pair<int, pair<expr_t, expr_t> > > &List_of_Op_RHS) const;
|
virtual pair<int, expr_t> normalizeEquation(int symb_id_endo, vector<pair<int, pair<expr_t, expr_t> > > &List_of_Op_RHS) const;
|
||||||
|
@ -1070,12 +1070,12 @@ protected:
|
||||||
const int symb_id;
|
const int symb_id;
|
||||||
const vector<expr_t> arguments;
|
const vector<expr_t> arguments;
|
||||||
//! Returns true if the given external function has been written as a temporary term
|
//! Returns true if the given external function has been written as a temporary term
|
||||||
bool alreadyWrittenAsTefTerm(int the_symb_id, deriv_node_temp_terms_t &tef_terms) const;
|
bool alreadyWrittenAsTefTerm(int the_symb_id, const deriv_node_temp_terms_t &tef_terms) const;
|
||||||
//! Returns the index in the tef_terms map of this external function
|
//! Returns the index in the tef_terms map of this external function
|
||||||
int getIndxInTefTerms(int the_symb_id, deriv_node_temp_terms_t &tef_terms) const throw (UnknownFunctionNameAndArgs);
|
int getIndxInTefTerms(int the_symb_id, const deriv_node_temp_terms_t &tef_terms) const throw (UnknownFunctionNameAndArgs);
|
||||||
//! Helper function to write output arguments of any given external function
|
//! Helper function to write output arguments of any given external function
|
||||||
void writeExternalFunctionArguments(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, deriv_node_temp_terms_t &tef_terms) const;
|
void writeExternalFunctionArguments(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, const deriv_node_temp_terms_t &tef_terms) const;
|
||||||
void writeJsonExternalFunctionArguments(ostream &output, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
|
void writeJsonExternalFunctionArguments(ostream &output, const temporary_terms_t &temporary_terms, const deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
|
||||||
public:
|
public:
|
||||||
AbstractExternalFunctionNode(DataTree &datatree_arg, int symb_id_arg,
|
AbstractExternalFunctionNode(DataTree &datatree_arg, int symb_id_arg,
|
||||||
const vector<expr_t> &arguments_arg);
|
const vector<expr_t> &arguments_arg);
|
||||||
|
@ -1083,8 +1083,8 @@ public:
|
||||||
virtual void computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReference> > &reference_count,
|
virtual void computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReference> > &reference_count,
|
||||||
map<NodeTreeReference, temporary_terms_t> &temp_terms_map,
|
map<NodeTreeReference, temporary_terms_t> &temp_terms_map,
|
||||||
bool is_matlab, NodeTreeReference tr) const = 0;
|
bool is_matlab, NodeTreeReference tr) const = 0;
|
||||||
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, deriv_node_temp_terms_t &tef_terms) const = 0;
|
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, const deriv_node_temp_terms_t &tef_terms) const = 0;
|
||||||
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms, const bool isdynamic = true) const = 0;
|
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, const deriv_node_temp_terms_t &tef_terms, const bool isdynamic = true) const = 0;
|
||||||
virtual bool containsExternalFunction() const;
|
virtual bool containsExternalFunction() const;
|
||||||
virtual void writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output_type,
|
virtual void writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
|
@ -1111,9 +1111,9 @@ public:
|
||||||
unsigned int compileExternalFunctionArguments(ostream &CompileCode, unsigned int &instruction_number,
|
unsigned int compileExternalFunctionArguments(ostream &CompileCode, unsigned int &instruction_number,
|
||||||
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
||||||
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
||||||
deriv_node_temp_terms_t &tef_terms) const;
|
const deriv_node_temp_terms_t &tef_terms) const;
|
||||||
|
|
||||||
virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, deriv_node_temp_terms_t &tef_terms) const = 0;
|
virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, const deriv_node_temp_terms_t &tef_terms) const = 0;
|
||||||
virtual expr_t toStatic(DataTree &static_datatree) const = 0;
|
virtual expr_t toStatic(DataTree &static_datatree) const = 0;
|
||||||
virtual void computeXrefs(EquationInfo &ei) const = 0;
|
virtual void computeXrefs(EquationInfo &ei) const = 0;
|
||||||
virtual pair<int, expr_t> normalizeEquation(int symb_id_endo, vector<pair<int, pair<expr_t, expr_t> > > &List_of_Op_RHS) const;
|
virtual pair<int, expr_t> normalizeEquation(int symb_id_endo, vector<pair<int, pair<expr_t, expr_t> > > &List_of_Op_RHS) const;
|
||||||
|
@ -1146,7 +1146,7 @@ public:
|
||||||
virtual bool containsExogenous() const;
|
virtual bool containsExogenous() const;
|
||||||
virtual bool isDiffPresent(void) const;
|
virtual bool isDiffPresent(void) const;
|
||||||
virtual bool isVariableNodeEqualTo(SymbolType type_arg, int variable_id, int lag_arg) const;
|
virtual bool isVariableNodeEqualTo(SymbolType type_arg, int variable_id, int lag_arg) const;
|
||||||
virtual void writePrhs(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, deriv_node_temp_terms_t &tef_terms, const string &ending) const;
|
virtual void writePrhs(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, const deriv_node_temp_terms_t &tef_terms, const string &ending) const;
|
||||||
virtual expr_t replaceTrendVar() const;
|
virtual expr_t replaceTrendVar() const;
|
||||||
virtual expr_t detrend(int symb_id, bool log_trend, expr_t trend) const;
|
virtual expr_t detrend(int symb_id, bool log_trend, expr_t trend) const;
|
||||||
virtual expr_t cloneDynamic(DataTree &dynamic_datatree) const = 0;
|
virtual expr_t cloneDynamic(DataTree &dynamic_datatree) const = 0;
|
||||||
|
@ -1172,8 +1172,8 @@ public:
|
||||||
virtual void computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReference> > &reference_count,
|
virtual void computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReference> > &reference_count,
|
||||||
map<NodeTreeReference, temporary_terms_t> &temp_terms_map,
|
map<NodeTreeReference, temporary_terms_t> &temp_terms_map,
|
||||||
bool is_matlab, NodeTreeReference tr) const;
|
bool is_matlab, NodeTreeReference tr) const;
|
||||||
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, deriv_node_temp_terms_t &tef_terms) const;
|
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, const deriv_node_temp_terms_t &tef_terms) const;
|
||||||
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
|
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, const deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
|
||||||
virtual void writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output_type,
|
virtual void writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
const temporary_terms_idxs_t &temporary_terms_idxs,
|
const temporary_terms_idxs_t &temporary_terms_idxs,
|
||||||
|
@ -1192,7 +1192,7 @@ public:
|
||||||
int Curr_block,
|
int Curr_block,
|
||||||
vector< vector<temporary_terms_t> > &v_temporary_terms,
|
vector< vector<temporary_terms_t> > &v_temporary_terms,
|
||||||
int equation) const;
|
int equation) const;
|
||||||
virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, deriv_node_temp_terms_t &tef_terms) const;
|
virtual void compile(ostream &CompileCode, unsigned int &instruction_number, bool lhs_rhs, const temporary_terms_t &temporary_terms, const map_idx_t &map_idx, bool dynamic, bool steady_dynamic, const deriv_node_temp_terms_t &tef_terms) const;
|
||||||
virtual expr_t toStatic(DataTree &static_datatree) const;
|
virtual expr_t toStatic(DataTree &static_datatree) const;
|
||||||
virtual void computeXrefs(EquationInfo &ei) const;
|
virtual void computeXrefs(EquationInfo &ei) const;
|
||||||
virtual expr_t buildSimilarExternalFunctionNode(vector<expr_t> &alt_args, DataTree &alt_datatree) const;
|
virtual expr_t buildSimilarExternalFunctionNode(vector<expr_t> &alt_args, DataTree &alt_datatree) const;
|
||||||
|
@ -1218,12 +1218,12 @@ public:
|
||||||
int Curr_block,
|
int Curr_block,
|
||||||
vector< vector<temporary_terms_t> > &v_temporary_terms,
|
vector< vector<temporary_terms_t> > &v_temporary_terms,
|
||||||
int equation) const;
|
int equation) const;
|
||||||
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, deriv_node_temp_terms_t &tef_terms) const;
|
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, const deriv_node_temp_terms_t &tef_terms) const;
|
||||||
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
|
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, const deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
|
||||||
virtual void compile(ostream &CompileCode, unsigned int &instruction_number,
|
virtual void compile(ostream &CompileCode, unsigned int &instruction_number,
|
||||||
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
||||||
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
||||||
deriv_node_temp_terms_t &tef_terms) const;
|
const deriv_node_temp_terms_t &tef_terms) const;
|
||||||
virtual void writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output_type,
|
virtual void writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
const temporary_terms_idxs_t &temporary_terms_idxs,
|
const temporary_terms_idxs_t &temporary_terms_idxs,
|
||||||
|
@ -1263,12 +1263,12 @@ public:
|
||||||
int Curr_block,
|
int Curr_block,
|
||||||
vector< vector<temporary_terms_t> > &v_temporary_terms,
|
vector< vector<temporary_terms_t> > &v_temporary_terms,
|
||||||
int equation) const;
|
int equation) const;
|
||||||
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, deriv_node_temp_terms_t &tef_terms) const;
|
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, const deriv_node_temp_terms_t &tef_terms) const;
|
||||||
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
|
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, const deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
|
||||||
virtual void compile(ostream &CompileCode, unsigned int &instruction_number,
|
virtual void compile(ostream &CompileCode, unsigned int &instruction_number,
|
||||||
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
||||||
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
||||||
deriv_node_temp_terms_t &tef_terms) const;
|
const deriv_node_temp_terms_t &tef_terms) const;
|
||||||
virtual void writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output_type,
|
virtual void writeExternalFunctionOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
const temporary_terms_t &temporary_terms,
|
const temporary_terms_t &temporary_terms,
|
||||||
const temporary_terms_idxs_t &temporary_terms_idxs,
|
const temporary_terms_idxs_t &temporary_terms_idxs,
|
||||||
|
@ -1299,7 +1299,7 @@ public:
|
||||||
virtual void computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReference> > &reference_count,
|
virtual void computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReference> > &reference_count,
|
||||||
map<NodeTreeReference, temporary_terms_t> &temp_terms_map,
|
map<NodeTreeReference, temporary_terms_t> &temp_terms_map,
|
||||||
bool is_matlab, NodeTreeReference tr) const;
|
bool is_matlab, NodeTreeReference tr) const;
|
||||||
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, deriv_node_temp_terms_t &tef_terms) const;
|
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, const deriv_node_temp_terms_t &tef_terms) const;
|
||||||
virtual void computeTemporaryTerms(map<expr_t, int> &reference_count,
|
virtual void computeTemporaryTerms(map<expr_t, int> &reference_count,
|
||||||
temporary_terms_t &temporary_terms,
|
temporary_terms_t &temporary_terms,
|
||||||
map<expr_t, pair<int, int> > &first_occurence,
|
map<expr_t, pair<int, int> > &first_occurence,
|
||||||
|
@ -1338,7 +1338,7 @@ public:
|
||||||
virtual void compile(ostream &CompileCode, unsigned int &instruction_number,
|
virtual void compile(ostream &CompileCode, unsigned int &instruction_number,
|
||||||
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
||||||
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
||||||
deriv_node_temp_terms_t &tef_terms) const;
|
const deriv_node_temp_terms_t &tef_terms) const;
|
||||||
virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const;
|
virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const;
|
||||||
virtual void collectVARLHSVariable(set<expr_t> &result) const;
|
virtual void collectVARLHSVariable(set<expr_t> &result) const;
|
||||||
virtual void collectDynamicVariables(SymbolType type_arg, set<pair<int, int> > &result) const;
|
virtual void collectDynamicVariables(SymbolType type_arg, set<pair<int, int> > &result) const;
|
||||||
|
@ -1360,7 +1360,7 @@ public:
|
||||||
virtual bool isVarModelReferenced(const string &model_info_name) const;
|
virtual bool isVarModelReferenced(const string &model_info_name) const;
|
||||||
virtual void getEndosAndMaxLags(map<string, int> &model_endos_and_lags) const;
|
virtual void getEndosAndMaxLags(map<string, int> &model_endos_and_lags) const;
|
||||||
virtual expr_t substituteStaticAuxiliaryVariable() const;
|
virtual expr_t substituteStaticAuxiliaryVariable() const;
|
||||||
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
|
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, const deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PacExpectationNode : public ExprNode
|
class PacExpectationNode : public ExprNode
|
||||||
|
@ -1382,7 +1382,7 @@ public:
|
||||||
virtual void computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReference> > &reference_count,
|
virtual void computeTemporaryTerms(map<expr_t, pair<int, NodeTreeReference> > &reference_count,
|
||||||
map<NodeTreeReference, temporary_terms_t> &temp_terms_map,
|
map<NodeTreeReference, temporary_terms_t> &temp_terms_map,
|
||||||
bool is_matlab, NodeTreeReference tr) const;
|
bool is_matlab, NodeTreeReference tr) const;
|
||||||
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, deriv_node_temp_terms_t &tef_terms) const;
|
virtual void writeOutput(ostream &output, ExprNodeOutputType output_type, const temporary_terms_t &temporary_terms, const temporary_terms_idxs_t &temporary_terms_idxs, const deriv_node_temp_terms_t &tef_terms) const;
|
||||||
virtual void computeTemporaryTerms(map<expr_t, int> &reference_count,
|
virtual void computeTemporaryTerms(map<expr_t, int> &reference_count,
|
||||||
temporary_terms_t &temporary_terms,
|
temporary_terms_t &temporary_terms,
|
||||||
map<expr_t, pair<int, int> > &first_occurence,
|
map<expr_t, pair<int, int> > &first_occurence,
|
||||||
|
@ -1421,7 +1421,7 @@ public:
|
||||||
virtual void compile(ostream &CompileCode, unsigned int &instruction_number,
|
virtual void compile(ostream &CompileCode, unsigned int &instruction_number,
|
||||||
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
bool lhs_rhs, const temporary_terms_t &temporary_terms,
|
||||||
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
const map_idx_t &map_idx, bool dynamic, bool steady_dynamic,
|
||||||
deriv_node_temp_terms_t &tef_terms) const;
|
const deriv_node_temp_terms_t &tef_terms) const;
|
||||||
virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const;
|
virtual void collectTemporary_terms(const temporary_terms_t &temporary_terms, temporary_terms_inuse_t &temporary_terms_inuse, int Curr_Block) const;
|
||||||
virtual void collectVARLHSVariable(set<expr_t> &result) const;
|
virtual void collectVARLHSVariable(set<expr_t> &result) const;
|
||||||
virtual void collectDynamicVariables(SymbolType type_arg, set<pair<int, int> > &result) const;
|
virtual void collectDynamicVariables(SymbolType type_arg, set<pair<int, int> > &result) const;
|
||||||
|
@ -1443,7 +1443,7 @@ public:
|
||||||
virtual bool isVarModelReferenced(const string &model_info_name) const;
|
virtual bool isVarModelReferenced(const string &model_info_name) const;
|
||||||
virtual void getEndosAndMaxLags(map<string, int> &model_endos_and_lags) const;
|
virtual void getEndosAndMaxLags(map<string, int> &model_endos_and_lags) const;
|
||||||
virtual expr_t substituteStaticAuxiliaryVariable() const;
|
virtual expr_t substituteStaticAuxiliaryVariable() const;
|
||||||
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
|
virtual void writeJsonOutput(ostream &output, const temporary_terms_t &temporary_terms, const deriv_node_temp_terms_t &tef_terms, const bool isdynamic) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2005,7 +2005,6 @@ ModelTree::isNonstationary(int symb_id) const
|
||||||
void
|
void
|
||||||
ModelTree::writeJsonModelEquations(ostream &output, bool residuals) const
|
ModelTree::writeJsonModelEquations(ostream &output, bool residuals) const
|
||||||
{
|
{
|
||||||
deriv_node_temp_terms_t tef_terms;
|
|
||||||
vector<pair<string, string> > eqtags;
|
vector<pair<string, string> > eqtags;
|
||||||
temporary_terms_t tt_empty;
|
temporary_terms_t tt_empty;
|
||||||
if (residuals)
|
if (residuals)
|
||||||
|
@ -2025,11 +2024,11 @@ ModelTree::writeJsonModelEquations(ostream &output, bool residuals) const
|
||||||
{
|
{
|
||||||
output << "{\"residual\": {"
|
output << "{\"residual\": {"
|
||||||
<< "\"lhs\": \"";
|
<< "\"lhs\": \"";
|
||||||
lhs->writeJsonOutput(output, temporary_terms, tef_terms);
|
lhs->writeJsonOutput(output, temporary_terms, {});
|
||||||
output << "\"";
|
output << "\"";
|
||||||
|
|
||||||
output << ", \"rhs\": \"";
|
output << ", \"rhs\": \"";
|
||||||
rhs->writeJsonOutput(output, temporary_terms, tef_terms);
|
rhs->writeJsonOutput(output, temporary_terms, {});
|
||||||
output << "\"";
|
output << "\"";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -2037,7 +2036,7 @@ ModelTree::writeJsonModelEquations(ostream &output, bool residuals) const
|
||||||
if (rhs->eval(eval_context_t()) != 0)
|
if (rhs->eval(eval_context_t()) != 0)
|
||||||
{
|
{
|
||||||
output << ", \"rhs\": \"";
|
output << ", \"rhs\": \"";
|
||||||
rhs->writeJsonOutput(output, temporary_terms, tef_terms);
|
rhs->writeJsonOutput(output, temporary_terms, {});
|
||||||
output << "\"";
|
output << "\"";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2049,9 +2048,9 @@ ModelTree::writeJsonModelEquations(ostream &output, bool residuals) const
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
output << "{\"lhs\": \"";
|
output << "{\"lhs\": \"";
|
||||||
lhs->writeJsonOutput(output, tt_empty, tef_terms);
|
lhs->writeJsonOutput(output, tt_empty, {});
|
||||||
output << "\", \"rhs\": \"";
|
output << "\", \"rhs\": \"";
|
||||||
rhs->writeJsonOutput(output, tt_empty, tef_terms);
|
rhs->writeJsonOutput(output, tt_empty, {});
|
||||||
output << "\""
|
output << "\""
|
||||||
<< ", \"line\": " << equations_lineno[eq];
|
<< ", \"line\": " << equations_lineno[eq];
|
||||||
|
|
||||||
|
|
|
@ -66,9 +66,8 @@ InitParamStatement::writeJuliaOutput(ostream &output, const string &basename)
|
||||||
void
|
void
|
||||||
InitParamStatement::writeJsonOutput(ostream &output) const
|
InitParamStatement::writeJsonOutput(ostream &output) const
|
||||||
{
|
{
|
||||||
deriv_node_temp_terms_t tef_terms;
|
|
||||||
output << "{\"statementName\": \"param_init\", \"name\": \"" << symbol_table.getName(symb_id) << "\", " << "\"value\": \"";
|
output << "{\"statementName\": \"param_init\", \"name\": \"" << symbol_table.getName(symb_id) << "\", " << "\"value\": \"";
|
||||||
param_value->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
param_value->writeJsonOutput(output, {}, {});
|
||||||
output << "\"}";
|
output << "\"}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,14 +176,13 @@ InitOrEndValStatement::writeInitValues(ostream &output) const
|
||||||
void
|
void
|
||||||
InitOrEndValStatement::writeJsonInitValues(ostream &output) const
|
InitOrEndValStatement::writeJsonInitValues(ostream &output) const
|
||||||
{
|
{
|
||||||
deriv_node_temp_terms_t tef_terms;
|
|
||||||
for (init_values_t::const_iterator it = init_values.begin();
|
for (init_values_t::const_iterator it = init_values.begin();
|
||||||
it != init_values.end(); it++)
|
it != init_values.end(); it++)
|
||||||
{
|
{
|
||||||
if (it != init_values.begin())
|
if (it != init_values.begin())
|
||||||
output << ", ";
|
output << ", ";
|
||||||
output << "{\"name\": \"" << symbol_table.getName(it->first) << "\", " << "\"value\": \"";
|
output << "{\"name\": \"" << symbol_table.getName(it->first) << "\", " << "\"value\": \"";
|
||||||
it->second->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->second->writeJsonOutput(output, {}, {});
|
||||||
output << "\"}";
|
output << "\"}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -419,7 +417,6 @@ HistValStatement::writeOutput(ostream &output, const string &basename, bool mini
|
||||||
void
|
void
|
||||||
HistValStatement::writeJsonOutput(ostream &output) const
|
HistValStatement::writeJsonOutput(ostream &output) const
|
||||||
{
|
{
|
||||||
deriv_node_temp_terms_t tef_terms;
|
|
||||||
output << "{\"statementName\": \"hist_val\", \"vals\": [";
|
output << "{\"statementName\": \"hist_val\", \"vals\": [";
|
||||||
for (hist_values_t::const_iterator it = hist_values.begin();
|
for (hist_values_t::const_iterator it = hist_values.begin();
|
||||||
it != hist_values.end(); it++)
|
it != hist_values.end(); it++)
|
||||||
|
@ -429,7 +426,7 @@ HistValStatement::writeJsonOutput(ostream &output) const
|
||||||
output << "{ \"name\": \"" << symbol_table.getName(it->first.first) << "\""
|
output << "{ \"name\": \"" << symbol_table.getName(it->first.first) << "\""
|
||||||
<< ", \"lag\": " << it->first.second
|
<< ", \"lag\": " << it->first.second
|
||||||
<< ", \"value\": \"";
|
<< ", \"value\": \"";
|
||||||
it->second->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->second->writeJsonOutput(output, {}, {});
|
||||||
output << "\"}";
|
output << "\"}";
|
||||||
}
|
}
|
||||||
output << "]}";
|
output << "]}";
|
||||||
|
@ -516,7 +513,6 @@ HomotopyStatement::writeOutput(ostream &output, const string &basename, bool min
|
||||||
void
|
void
|
||||||
HomotopyStatement::writeJsonOutput(ostream &output) const
|
HomotopyStatement::writeJsonOutput(ostream &output) const
|
||||||
{
|
{
|
||||||
deriv_node_temp_terms_t tef_terms;
|
|
||||||
output << "{\"statementName\": \"homotopy\", "
|
output << "{\"statementName\": \"homotopy\", "
|
||||||
<< "\"values\": [";
|
<< "\"values\": [";
|
||||||
for (homotopy_values_t::const_iterator it = homotopy_values.begin();
|
for (homotopy_values_t::const_iterator it = homotopy_values.begin();
|
||||||
|
@ -527,11 +523,11 @@ HomotopyStatement::writeJsonOutput(ostream &output) const
|
||||||
output << "{\"name\": \"" << symbol_table.getName(it->first) << "\""
|
output << "{\"name\": \"" << symbol_table.getName(it->first) << "\""
|
||||||
<< ", \"initial_value\": \"";
|
<< ", \"initial_value\": \"";
|
||||||
if (it->second.first != NULL)
|
if (it->second.first != NULL)
|
||||||
it->second.first->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->second.first->writeJsonOutput(output, {}, {});
|
||||||
else
|
else
|
||||||
output << "NaN";
|
output << "NaN";
|
||||||
output << "\", \"final_value\": \"";
|
output << "\", \"final_value\": \"";
|
||||||
it->second.second->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->second.second->writeJsonOutput(output, {}, {});
|
||||||
output << "\"}";
|
output << "\"}";
|
||||||
}
|
}
|
||||||
output << "]"
|
output << "]"
|
||||||
|
@ -625,7 +621,6 @@ LoadParamsAndSteadyStateStatement::writeOutput(ostream &output, const string &ba
|
||||||
void
|
void
|
||||||
LoadParamsAndSteadyStateStatement::writeJsonOutput(ostream &output) const
|
LoadParamsAndSteadyStateStatement::writeJsonOutput(ostream &output) const
|
||||||
{
|
{
|
||||||
deriv_node_temp_terms_t tef_terms;
|
|
||||||
output << "{\"statementName\": \"load_params_and_steady_state\""
|
output << "{\"statementName\": \"load_params_and_steady_state\""
|
||||||
<< "\"values\": [";
|
<< "\"values\": [";
|
||||||
for (map<int, string>::const_iterator it = content.begin();
|
for (map<int, string>::const_iterator it = content.begin();
|
||||||
|
|
|
@ -70,7 +70,6 @@ AbstractShocksStatement::writeDetShocks(ostream &output) const
|
||||||
void
|
void
|
||||||
AbstractShocksStatement::writeJsonDetShocks(ostream &output) const
|
AbstractShocksStatement::writeJsonDetShocks(ostream &output) const
|
||||||
{
|
{
|
||||||
deriv_node_temp_terms_t tef_terms;
|
|
||||||
output << "\"deterministic_shocks\": [";
|
output << "\"deterministic_shocks\": [";
|
||||||
for (det_shocks_t::const_iterator it = det_shocks.begin();
|
for (det_shocks_t::const_iterator it = det_shocks.begin();
|
||||||
it != det_shocks.end(); it++)
|
it != det_shocks.end(); it++)
|
||||||
|
@ -87,7 +86,7 @@ AbstractShocksStatement::writeJsonDetShocks(ostream &output) const
|
||||||
output << "{\"period1\": " << it1->period1 << ", "
|
output << "{\"period1\": " << it1->period1 << ", "
|
||||||
<< "\"period2\": " << it1->period2 << ", "
|
<< "\"period2\": " << it1->period2 << ", "
|
||||||
<< "\"value\": \"";
|
<< "\"value\": \"";
|
||||||
it1->value->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it1->value->writeJsonOutput(output, {}, {});
|
||||||
output << "\"}";
|
output << "\"}";
|
||||||
}
|
}
|
||||||
output << "]}";
|
output << "]}";
|
||||||
|
@ -154,7 +153,6 @@ ShocksStatement::writeOutput(ostream &output, const string &basename, bool minim
|
||||||
void
|
void
|
||||||
ShocksStatement::writeJsonOutput(ostream &output) const
|
ShocksStatement::writeJsonOutput(ostream &output) const
|
||||||
{
|
{
|
||||||
deriv_node_temp_terms_t tef_terms;
|
|
||||||
output << "{\"statementName\": \"shocks\""
|
output << "{\"statementName\": \"shocks\""
|
||||||
<< ", \"overwrite\": ";
|
<< ", \"overwrite\": ";
|
||||||
if (overwrite)
|
if (overwrite)
|
||||||
|
@ -173,7 +171,7 @@ ShocksStatement::writeJsonOutput(ostream &output) const
|
||||||
output << ", ";
|
output << ", ";
|
||||||
output << "{\"name\": \"" << symbol_table.getName(it->first) << "\", "
|
output << "{\"name\": \"" << symbol_table.getName(it->first) << "\", "
|
||||||
<< "\"variance\": \"";
|
<< "\"variance\": \"";
|
||||||
it->second->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->second->writeJsonOutput(output, {}, {});
|
||||||
output << "\"}";
|
output << "\"}";
|
||||||
}
|
}
|
||||||
output << "]"
|
output << "]"
|
||||||
|
@ -184,7 +182,7 @@ ShocksStatement::writeJsonOutput(ostream &output) const
|
||||||
output << ", ";
|
output << ", ";
|
||||||
output << "{\"name\": \"" << symbol_table.getName(it->first) << "\", "
|
output << "{\"name\": \"" << symbol_table.getName(it->first) << "\", "
|
||||||
<< "\"stderr\": \"";
|
<< "\"stderr\": \"";
|
||||||
it->second->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->second->writeJsonOutput(output, {}, {});
|
||||||
output << "\"}";
|
output << "\"}";
|
||||||
}
|
}
|
||||||
output << "]"
|
output << "]"
|
||||||
|
@ -197,7 +195,7 @@ ShocksStatement::writeJsonOutput(ostream &output) const
|
||||||
<< "\"name\": \"" << symbol_table.getName(it->first.first) << "\", "
|
<< "\"name\": \"" << symbol_table.getName(it->first.first) << "\", "
|
||||||
<< "\"name2\": \"" << symbol_table.getName(it->first.second) << "\", "
|
<< "\"name2\": \"" << symbol_table.getName(it->first.second) << "\", "
|
||||||
<< "\"covariance\": \"";
|
<< "\"covariance\": \"";
|
||||||
it->second->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->second->writeJsonOutput(output, {}, {});
|
||||||
output << "\"}";
|
output << "\"}";
|
||||||
}
|
}
|
||||||
output << "]"
|
output << "]"
|
||||||
|
@ -210,7 +208,7 @@ ShocksStatement::writeJsonOutput(ostream &output) const
|
||||||
<< "\"name\": \"" << symbol_table.getName(it->first.first) << "\", "
|
<< "\"name\": \"" << symbol_table.getName(it->first.first) << "\", "
|
||||||
<< "\"name2\": \"" << symbol_table.getName(it->first.second) << "\", "
|
<< "\"name2\": \"" << symbol_table.getName(it->first.second) << "\", "
|
||||||
<< "\"correlation\": \"";
|
<< "\"correlation\": \"";
|
||||||
it->second->writeJsonOutput(output, temporary_terms_t(), tef_terms);
|
it->second->writeJsonOutput(output, {}, {});
|
||||||
output << "\"}";
|
output << "\"}";
|
||||||
}
|
}
|
||||||
output << "]"
|
output << "]"
|
||||||
|
|
|
@ -277,9 +277,7 @@ SteadyStateModel::writeJsonSteadyStateFile(ostream &output, bool transformComput
|
||||||
if (def_table.size() == 0)
|
if (def_table.size() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
deriv_node_temp_terms_t tef_terms;
|
|
||||||
vector<pair<string, string> > eqtags;
|
vector<pair<string, string> > eqtags;
|
||||||
temporary_terms_t tt_empty;
|
|
||||||
|
|
||||||
output << "{\"steady_state_model\": [";
|
output << "{\"steady_state_model\": [";
|
||||||
|
|
||||||
|
@ -299,13 +297,13 @@ SteadyStateModel::writeJsonSteadyStateFile(ostream &output, bool transformComput
|
||||||
variable_node_map.find(make_pair(symb_ids[j], 0));
|
variable_node_map.find(make_pair(symb_ids[j], 0));
|
||||||
assert(it != variable_node_map.end());
|
assert(it != variable_node_map.end());
|
||||||
output << "\"";
|
output << "\"";
|
||||||
dynamic_cast<ExprNode *>(it->second)->writeJsonOutput(output, tt_empty, tef_terms, false);
|
dynamic_cast<ExprNode *>(it->second)->writeJsonOutput(output, {}, {}, false);
|
||||||
output << "\"";
|
output << "\"";
|
||||||
}
|
}
|
||||||
if (symb_ids.size() > 1)
|
if (symb_ids.size() > 1)
|
||||||
output << "]";
|
output << "]";
|
||||||
output << ", \"rhs\":\"";
|
output << ", \"rhs\":\"";
|
||||||
def_table[i].second->writeJsonOutput(output, tt_empty, tef_terms, false);
|
def_table[i].second->writeJsonOutput(output, {}, {}, false);
|
||||||
output << "\"}" << endl;
|
output << "\"}" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue