From 9d0d9f0f8366b72d6931e604165e6ef5f8aa3a94 Mon Sep 17 00:00:00 2001 From: sebastien <sebastien@ac1d8469-bf42-47a9-8791-bf33cf982152> Date: Thu, 22 Jan 2009 15:05:38 +0000 Subject: [PATCH] trunk preprocessor: allow arbitrary expressions (and not just constants) in estimated_params, estimated_params_init and estimated_params_bounds blocks git-svn-id: https://www.dynare.org/svn/dynare/trunk@2368 ac1d8469-bf42-47a9-8791-bf33cf982152 --- ComputingTasks.cc | 177 +++++++++++++++++++++++----------- DataTree.cc | 6 +- DynareBison.yy | 131 ++++++++++--------------- DynareFlex.ll | 4 +- NumericalConstants.cc | 8 +- ParsingDriver.cc | 15 ++- include/ComputingTasks.hh | 47 +++------ include/DataTree.hh | 4 +- include/NumericalConstants.hh | 3 +- include/ParsingDriver.hh | 6 +- 10 files changed, 218 insertions(+), 183 deletions(-) diff --git a/ComputingTasks.cc b/ComputingTasks.cc index fe4cf85c..b8b9b6a9 100644 --- a/ComputingTasks.cc +++ b/ComputingTasks.cc @@ -409,47 +409,62 @@ EstimatedParamsStatement::EstimatedParamsStatement(const vector<EstimationParams void EstimatedParamsStatement::writeOutput(ostream &output, const string &basename) const { - output << "global estim_params_\n"; - output << "var_list_ = [];\n"; - output << "estim_params_.var_exo = [];\n"; - output << "estim_params_.var_endo = [];\n"; - output << "estim_params_.corrx = [];\n"; - output << "estim_params_.corrn = [];\n"; - output << "estim_params_.param_names = [];\n"; - output << "estim_params_.user_param_names = [];\n"; - output << "estim_params_.param_vals = [];\n"; - output << "M_.H = 0;\n"; + output << "global estim_params_" << endl + << "estim_params_.var_exo = [];" << endl + << "estim_params_.var_endo = [];" << endl + << "estim_params_.corrx = [];" << endl + << "estim_params_.corrn = [];" << endl + << "estim_params_.param_names = [];" << endl + << "estim_params_.user_param_names = [];" << endl + << "estim_params_.param_vals = [];" << endl + << "M_.H = 0;" << endl; vector<EstimationParams>::const_iterator it; for(it = estim_params_list.begin(); it != estim_params_list.end(); it++) { + int symb_id = symbol_table.getID(it->name) + 1; + SymbolType symb_type = symbol_table.getType(it->name); + switch(it->type) { case 1: - if (symbol_table.getType(it->name) == eExogenous) + if (symb_type == eExogenous) output << "estim_params_.var_exo = [estim_params_.var_exo; "; - else if (symbol_table.getType(it->name) == eEndogenous) + else if (symb_type == eEndogenous) output << "estim_params_.var_endo = [estim_params_.var_endo; "; - output << symbol_table.getID(it->name)+1; + output << symb_id; break; case 2: - output << "estim_params_.param_vals = [estim_params_.param_vals; "; - output << symbol_table.getID(it->name)+1; + output << "estim_params_.param_vals = [estim_params_.param_vals; " + << symb_id; break; case 3: - if (symbol_table.getType(it->name) == eExogenous) + if (symb_type == eExogenous) output << "estim_params_.corrx = [estim_params_.corrx; "; - else if (symbol_table.getType(it->name) == eEndogenous) + else if (symb_type == eEndogenous) output << "estim_params_.corrn = [estim_params_.corrn; "; - output << symbol_table.getID(it->name)+1; - output << " " << symbol_table.getID(it->name2)+1; + output << symb_id << " " << symbol_table.getID(it->name2)+1; break; } - output << " " << it->init_val << " " << it->low_bound - << " " << it->up_bound << " " << it->prior - << " " << it->mean << " " << it->std - << " " << it->p3 << " " << it->p4 << " " << it->jscale << "];\n"; + output << ", "; + it->init_val->writeOutput(output); + output << ", "; + it->low_bound->writeOutput(output); + output << ", "; + it->up_bound->writeOutput(output); + output << ", " + << it->prior << ", "; + it->mean->writeOutput(output); + output << ", "; + it->std->writeOutput(output); + output << ", "; + it->p3->writeOutput(output); + output << ", "; + it->p4->writeOutput(output); + output << ", "; + it->jscale->writeOutput(output); + output << " ];" << endl; } } @@ -467,35 +482,48 @@ EstimatedParamsInitStatement::writeOutput(ostream &output, const string &basenam for(it = estim_params_list.begin(); it != estim_params_list.end(); it++) { + int symb_id = symbol_table.getID(it->name) + 1; + SymbolType symb_type = symbol_table.getType(it->name); + if (it->type < 3) { - if (symbol_table.getType(it->name) == eExogenous) + if (symb_type == eExogenous) { - output << "tmp1 = find(estim_params_.var_exo(:,1)==" << symbol_table.getID(it->name)+1 << ");\n"; - output << "estim_params_.var_exo(tmp1,2) = " << it->init_val << ";\n"; + output << "tmp1 = find(estim_params_.var_exo(:,1)==" << symb_id << ");" << endl; + output << "estim_params_.var_exo(tmp1,2) = "; + it->init_val->writeOutput(output); + output << ";" << endl; } - else if (symbol_table.getType(it->name) == eEndogenous) + else if (symb_type == eEndogenous) { - output << "tmp1 = find(estim_params_.var_endo(:,1)==" << symbol_table.getID(it->name)+1 << ");\n"; - output << "estim_params_.var_endo(tmp1,2) = " << it->init_val << ";\n"; + output << "tmp1 = find(estim_params_.var_endo(:,1)==" << symb_id << ");" << endl; + output << "estim_params_.var_endo(tmp1,2) = "; + it->init_val->writeOutput(output); + output << ";" << endl; } - else if (symbol_table.getType(it->name) == eParameter) + else if (symb_type == eParameter) { - output << "tmp1 = find(estim_params_.param_vals(:,1)==" << symbol_table.getID(it->name)+1 << ");\n"; - output << "estim_params_.param_vals(tmp1,2) = " << it->init_val << ";\n"; + output << "tmp1 = find(estim_params_.param_vals(:,1)==" << symb_id << ");" << endl; + output << "estim_params_.param_vals(tmp1,2) = "; + it->init_val->writeOutput(output); + output << ";" << endl; } } else { - if (symbol_table.getType(it->name) == eExogenous) + if (symb_type == eExogenous) { - output << "tmp1 = find((estim_params_.corrx(:,1)==" << symbol_table.getID(it->name)+1 << ")) & (estim_params_.corrx(:,2)==" << symbol_table.getID(it->name2)+1 << ");\n"; - output << "estim_params_.corrx(tmp1,3) = " << it->init_val << ";\n"; + output << "tmp1 = find((estim_params_.corrx(:,1)==" << symb_id << ")) & (estim_params_.corrx(:,2)==" << symbol_table.getID(it->name2)+1 << ");" << endl; + output << "estim_params_.corrx(tmp1,3) = "; + it->init_val->writeOutput(output); + output << ";" << endl; } - else if (symbol_table.getType(it->name) == eEndogenous) + else if (symb_type == eEndogenous) { - output << "tmp1 = find((estim_params_.corrn(:,1)==" << symbol_table.getID(it->name)+1 << ")) & (estim_params_.corrn(:,2)==" << symbol_table.getID(it->name2)+1 << ";\n"; - output << "estim_params_.corrn(tmp1,3) = " << it->init_val << ";\n"; + output << "tmp1 = find((estim_params_.corrn(:,1)==" << symb_id << ")) & (estim_params_.corrn(:,2)==" << symbol_table.getID(it->name2)+1 << ";" << endl; + output << "estim_params_.corrn(tmp1,3) = "; + it->init_val->writeOutput(output); + output << ";" << endl; } } } @@ -515,40 +543,73 @@ EstimatedParamsBoundsStatement::writeOutput(ostream &output, const string &basen for(it = estim_params_list.begin(); it != estim_params_list.end(); it++) { + int symb_id = symbol_table.getID(it->name) + 1; + SymbolType symb_type = symbol_table.getType(it->name); + if (it->type < 3) { - if (symbol_table.getType(it->name) == eExogenous) + if (symb_type == eExogenous) { - output << "tmp1 = find(estim_params_.var_exo(:,1)==" << symbol_table.getID(it->name)+1 << ");\n"; - output << "estim_params_.var_exo(tmp1,3) = " << it->low_bound << ";\n"; - output << "estim_params_.var_exo(tmp1,4) = " << it->up_bound << ";\n"; + output << "tmp1 = find(estim_params_.var_exo(:,1)==" << symb_id << ");" << endl; + + output << "estim_params_.var_exo(tmp1,3) = "; + it->low_bound->writeOutput(output); + output << ";" << endl; + + output << "estim_params_.var_exo(tmp1,4) = "; + it->up_bound->writeOutput(output); + output << ";" << endl; } - else if (symbol_table.getType(it->name) == eEndogenous) + else if (symb_type == eEndogenous) { - output << "tmp1 = find(estim_params_.var_endo(:,1)==" << symbol_table.getID(it->name)+1 << ");\n"; - output << "estim_params_.var_endo(tmp1,3) = " << it->low_bound << ";\n"; - output << "estim_params_.var_endo(tmp1,4) = " << it->up_bound << ";\n"; + output << "tmp1 = find(estim_params_.var_endo(:,1)==" << symb_id << ");" << endl; + + output << "estim_params_.var_endo(tmp1,3) = "; + it->low_bound->writeOutput(output); + output << ";" << endl; + + output << "estim_params_.var_endo(tmp1,4) = "; + it->up_bound->writeOutput(output); + output << ";" << endl; } - else if (symbol_table.getType(it->name) == eParameter) + else if (symb_type == eParameter) { - output << "tmp1 = find(estim_params_.param_vals(:,1)==" << symbol_table.getID(it->name)+1 << ");\n"; - output << "estim_params_.param_vals(tmp1,3) = " << it->low_bound << ";\n"; - output << "estim_params_.param_vals(tmp1,4) = " << it->up_bound << ";\n"; + output << "tmp1 = find(estim_params_.param_vals(:,1)==" << symb_id << ");" << endl; + + output << "estim_params_.param_vals(tmp1,3) = "; + it->low_bound->writeOutput(output); + output << ";" << endl; + + output << "estim_params_.param_vals(tmp1,4) = "; + it->up_bound->writeOutput(output); + output << ";" << endl; } } else { - if (symbol_table.getType(it->name) == eExogenous) + if (symb_type == eExogenous) { - output << "tmp1 = find((estim_params_.corrx(:,1)==" << symbol_table.getID(it->name)+1 << ")) & (estim_params_.corrx(:,2)==" << symbol_table.getID(it->name2)+1 << ");\n"; - output << "estim_params_.corrx(tmp1,4) = " << it->low_bound << ";\n"; - output << "estim_params_.corrx(tmp1,5) = " << it->up_bound << ";\n"; + output << "tmp1 = find((estim_params_.corrx(:,1)==" << symb_id << ")) & (estim_params_.corrx(:,2)==" << symbol_table.getID(it->name2)+1 << ");" << endl; + + output << "estim_params_.corrx(tmp1,4) = "; + it->low_bound->writeOutput(output); + output << ";" << endl; + + output << "estim_params_.corrx(tmp1,5) = "; + it->up_bound->writeOutput(output); + output << ";" << endl; } - else if (symbol_table.getType(it->name) == eEndogenous) + else if (symb_type == eEndogenous) { - output << "tmp1 = find((estim_params_.corrn(:,1)==" << symbol_table.getID(it->name)+1 << ")) & (estim_params_.corrn(:,2)==" << symbol_table.getID(it->name2)+1 << ";\n"; - output << "estim_params_.corrn(tmp1,4) = " << it->low_bound << ";\n"; - output << "estim_params_.corrn(tmp1,5) = " << it->up_bound << ";\n"; + output << "tmp1 = find((estim_params_.corrn(:,1)==" << symb_id << ")) & (estim_params_.corrn(:,2)==" << symbol_table.getID(it->name2)+1 << ";" << endl; + + output << "estim_params_.corrn(tmp1,4) = "; + it->low_bound->writeOutput(output); + output << ";" << endl; + + output << "estim_params_.corrn(tmp1,5) = "; + it->up_bound->writeOutput(output); + output << ";" << endl; } } } diff --git a/DataTree.cc b/DataTree.cc index 487646ac..7fd99f07 100644 --- a/DataTree.cc +++ b/DataTree.cc @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2008 Dynare Team + * Copyright (C) 2003-2009 Dynare Team * * This file is part of Dynare. * @@ -32,6 +32,10 @@ DataTree::DataTree(SymbolTable &symbol_table_arg, NumericalConstants &num_consta One = AddNumConstant("1"); MinusOne = AddUMinus(One); + + NaN = AddNumConstant("NaN"); + Infinity = AddNumConstant("Inf"); + MinusInfinity = AddUMinus(Infinity); } DataTree::~DataTree() diff --git a/DynareBison.yy b/DynareBison.yy index a294e339..3dbc60a9 100644 --- a/DynareBison.yy +++ b/DynareBison.yy @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2008 Dynare Team + * Copyright (C) 2003-2009 Dynare Team * * This file is part of Dynare. * @@ -92,7 +92,7 @@ class ParsingDriver; %token FORECAST %token GAMMA_PDF GAUSSIAN_ELIMINATION GMRES GRAPH %token HISTVAL HP_FILTER HP_NGRID -%token INITVAL INITVAL_FILE +%token INF_CONSTANT INITVAL INITVAL_FILE %token <string_val> INT_NUMBER %token INV_GAMMA1_PDF INV_GAMMA2_PDF IRF %token KALMAN_ALGO KALMAN_TOL @@ -102,7 +102,7 @@ class ParsingDriver; %token MODE_CHECK MODE_COMPUTE MODE_FILE MODEL MODEL_COMPARISON MODEL_INFO MSHOCKS %token MODIFIEDHARMONICMEAN MOMENTS_VARENDO DIFFUSE_FILTER %token <string_val> NAME -%token NOBS NOCONSTANT NOCORR NODIAGNOSTIC NOFUNCTIONS +%token NAN_CONSTANT NOBS NOCONSTANT NOCORR NODIAGNOSTIC NOFUNCTIONS %token NOGRAPH NOMOMENTS NOPRINT NORMAL_PDF %token OBSERVATION_TRENDS OPTIM OPTIM_WEIGHTS ORDER OSR OSR_PARAMS %token PARAMETERS PERIODS PLANNER_OBJECTIVE PREFILTER PRESAMPLE @@ -364,6 +364,10 @@ expression : '(' expression ')' { $$ = driver.add_normcdf($3, $5, $7); } | NORMCDF '(' expression ')' { $$ = driver.add_normcdf($3); } + | NAN_CONSTANT + { $$ = driver.add_nan_constant(); } + | INF_CONSTANT + { $$ = driver.add_inf_constant(); } ; comma_expression : expression @@ -734,79 +738,57 @@ estimated_elem2 : prior COMMA estimated_elem3 driver.estim_params.prior = *$1; delete $1; } - | value COMMA prior COMMA estimated_elem3 + | expression COMMA prior COMMA estimated_elem3 { - driver.estim_params.init_val = *$1; + driver.estim_params.init_val = $1; driver.estim_params.prior = *$3; - delete $1; delete $3; } - | value COMMA value COMMA value COMMA prior COMMA estimated_elem3 + | expression COMMA expression COMMA expression COMMA prior COMMA estimated_elem3 { - driver.estim_params.init_val = *$1; - driver.estim_params.low_bound = *$3; - driver.estim_params.up_bound = *$5; + driver.estim_params.init_val = $1; + driver.estim_params.low_bound = $3; + driver.estim_params.up_bound = $5; driver.estim_params.prior = *$7; - delete $1; - delete $3; - delete $5; delete $7; } - | value + | expression { - driver.estim_params.init_val = *$1; - delete $1; + driver.estim_params.init_val = $1; } - | value COMMA value COMMA value + | expression COMMA expression COMMA expression { - driver.estim_params.init_val = *$1; - driver.estim_params.low_bound = *$3; - driver.estim_params.up_bound = *$5; - delete $1; - delete $3; - delete $5; + driver.estim_params.init_val = $1; + driver.estim_params.low_bound = $3; + driver.estim_params.up_bound = $5; } ; -estimated_elem3 : value COMMA value +estimated_elem3 : expression COMMA expression { - driver.estim_params.mean = *$1; - driver.estim_params.std = *$3; - delete $1; - delete $3; + driver.estim_params.mean = $1; + driver.estim_params.std = $3; } - | value COMMA value COMMA value + | expression COMMA expression COMMA expression { - driver.estim_params.mean = *$1; - driver.estim_params.std = *$3; - driver.estim_params.p3 = *$5; - delete $1; - delete $3; - delete $5; + driver.estim_params.mean = $1; + driver.estim_params.std = $3; + driver.estim_params.p3 = $5; } - | value COMMA value COMMA value COMMA value + | expression COMMA expression COMMA expression COMMA expression { - driver.estim_params.mean = *$1; - driver.estim_params.std = *$3; - driver.estim_params.p3 = *$5; - driver.estim_params.p4 = *$7; - delete $1; - delete $3; - delete $5; - delete $7; + driver.estim_params.mean = $1; + driver.estim_params.std = $3; + driver.estim_params.p3 = $5; + driver.estim_params.p4 = $7; } - | value COMMA value COMMA value COMMA value COMMA value + | expression COMMA expression COMMA expression COMMA expression COMMA expression { - driver.estim_params.mean = *$1; - driver.estim_params.std = *$3; - driver.estim_params.p3 = *$5; - driver.estim_params.p4 = *$7; - driver.estim_params.jscale = *$9; - delete $1; - delete $3; - delete $5; - delete $7; - delete $9; + driver.estim_params.mean = $1; + driver.estim_params.std = $3; + driver.estim_params.p3 = $5; + driver.estim_params.p4 = $7; + driver.estim_params.jscale = $9; } ; @@ -819,31 +801,28 @@ estimated_init_list : estimated_init_list estimated_init_elem { driver.add_estimated_params_element(); } ; -estimated_init_elem : STDERR NAME COMMA value ';' +estimated_init_elem : STDERR NAME COMMA expression ';' { driver.estim_params.type = 1; driver.estim_params.name = *$2; - driver.estim_params.init_val = *$4; + driver.estim_params.init_val = $4; delete $2; - delete $4; } - | CORR NAME COMMA NAME COMMA value ';' + | CORR NAME COMMA NAME COMMA expression ';' { driver.estim_params.type = 3; driver.estim_params.name = *$2; driver.estim_params.name2 = *$4; - driver.estim_params.init_val = *$6; + driver.estim_params.init_val = $6; delete $2; delete $4; - delete $6; } - | NAME COMMA value ';' + | NAME COMMA expression ';' { driver.estim_params.type = 2; driver.estim_params.name = *$1; - driver.estim_params.init_val = *$3; + driver.estim_params.init_val = $3; delete $1; - delete $3; } ; @@ -856,37 +835,31 @@ estimated_bounds_list : estimated_bounds_list estimated_bounds_elem { driver.add_estimated_params_element(); } ; -estimated_bounds_elem : STDERR NAME COMMA value COMMA value ';' +estimated_bounds_elem : STDERR NAME COMMA expression COMMA expression ';' { driver.estim_params.type = 1; driver.estim_params.name = *$2; - driver.estim_params.low_bound = *$4; - driver.estim_params.up_bound = *$6; + driver.estim_params.low_bound = $4; + driver.estim_params.up_bound = $6; delete $2; - delete $4; - delete $6; } - | CORR NAME COMMA NAME COMMA value COMMA value ';' + | CORR NAME COMMA NAME COMMA expression COMMA expression ';' { driver.estim_params.type = 3; driver.estim_params.name = *$2; driver.estim_params.name2 = *$4; - driver.estim_params.low_bound = *$6; - driver.estim_params.up_bound = *$8; + driver.estim_params.low_bound = $6; + driver.estim_params.up_bound = $8; delete $2; delete $4; - delete $6; - delete $8; } - | NAME COMMA value COMMA value ';' + | NAME COMMA expression COMMA expression ';' { driver.estim_params.type = 2; driver.estim_params.name = *$1; - driver.estim_params.low_bound = *$3; - driver.estim_params.up_bound = *$5; + driver.estim_params.low_bound = $3; + driver.estim_params.up_bound = $5; delete $1; - delete $3; - delete $5; } ; diff --git a/DynareFlex.ll b/DynareFlex.ll index 980f2b67..8f894e7d 100644 --- a/DynareFlex.ll +++ b/DynareFlex.ll @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2008 Dynare Team + * Copyright (C) 2003-2009 Dynare Team * * This file is part of Dynare. * @@ -329,6 +329,8 @@ int sigma_e = 0; <DYNARE_STATEMENT,DYNARE_BLOCK>max {return token::MAX;} <DYNARE_STATEMENT,DYNARE_BLOCK>min {return token::MIN;} <DYNARE_STATEMENT,DYNARE_BLOCK>normcdf {return token::NORMCDF;} +<DYNARE_STATEMENT,DYNARE_BLOCK>nan {return token::NAN_CONSTANT;} +<DYNARE_STATEMENT,DYNARE_BLOCK>inf {return token::INF_CONSTANT;} /* options for GSA module by Marco Ratto */ <DYNARE_STATEMENT>identification {return token::IDENTIFICATION;} diff --git a/NumericalConstants.cc b/NumericalConstants.cc index 7f743023..3c89d5f7 100644 --- a/NumericalConstants.cc +++ b/NumericalConstants.cc @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2008 Dynare Team + * Copyright (C) 2003-2009 Dynare Team * * This file is part of Dynare. * @@ -22,12 +22,6 @@ #include "NumericalConstants.hh" -NumericalConstants::NumericalConstants() -{ - AddConstant("0"); - AddConstant("1"); -} - int NumericalConstants::AddConstant(const string &iConst) { diff --git a/ParsingDriver.cc b/ParsingDriver.cc index 3a4367d0..0ab9fe50 100644 --- a/ParsingDriver.cc +++ b/ParsingDriver.cc @@ -61,6 +61,7 @@ ParsingDriver::parse(istream &in, bool debug) symbol_list.clear(); reset_data_tree(); + estim_params.init(*data_tree); lexer = new DynareFlex(&in); lexer->set_debug(debug); @@ -150,6 +151,18 @@ ParsingDriver::add_constant(string *constant) return id; } +NodeID +ParsingDriver::add_nan_constant() +{ + return data_tree->NaN; +} + +NodeID +ParsingDriver::add_inf_constant() +{ + return data_tree->Infinity; +} + NodeID ParsingDriver::add_model_variable(string *name) { @@ -741,7 +754,7 @@ ParsingDriver::add_estimated_params_element() check_symbol_existence(estim_params.name2); estim_params_list.push_back(estim_params); - estim_params.clear(); + estim_params.init(*data_tree); } void diff --git a/include/ComputingTasks.hh b/include/ComputingTasks.hh index 27a71994..0699bcae 100644 --- a/include/ComputingTasks.hh +++ b/include/ComputingTasks.hh @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2008 Dynare Team + * Copyright (C) 2003-2009 Dynare Team * * This file is part of Dynare. * @@ -321,43 +321,28 @@ public: virtual void writeOutput(ostream &output, const string &basename) const; }; -/*! - \class EstimationParams - \brief EstimationParams -*/ -struct EstimationParams +//! Temporary structure used when parsing estimation_params* statements +class EstimationParams { +public: int type; - std::string name; - std::string name2; - std::string init_val; - std::string prior; - std::string low_bound; - std::string up_bound; - std::string mean; - std::string std; - std::string p3; - std::string p4; - std::string jscale; - - EstimationParams() - { - clear(); - } - void clear() + string name, name2, prior; + NodeID init_val, low_bound, up_bound, mean, std, p3, p4, jscale; + + void init(const DataTree &datatree) { type = 0; name = ""; name2 = ""; - init_val = "NaN"; prior = "NaN"; - low_bound = "-Inf"; - up_bound = "Inf"; - mean = "NaN"; - std = "NaN"; - p3 = "NaN"; - p4 = "NaN"; - jscale = "NaN"; + init_val = datatree.NaN; + low_bound = datatree.MinusInfinity; + up_bound = datatree.Infinity; + mean = datatree.NaN; + std = datatree.NaN; + p3 = datatree.NaN; + p4 = datatree.NaN; + jscale = datatree.NaN; } }; diff --git a/include/DataTree.hh b/include/DataTree.hh index e2029553..db77f657 100644 --- a/include/DataTree.hh +++ b/include/DataTree.hh @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2008 Dynare Team + * Copyright (C) 2003-2009 Dynare Team * * This file is part of Dynare. * @@ -78,7 +78,7 @@ public: virtual ~DataTree(); //! The variable table VariableTable variable_table; - NodeID Zero, One, MinusOne; + NodeID Zero, One, MinusOne, NaN, Infinity, MinusInfinity; //! Stores local variables value map<int, NodeID> local_variables_table; diff --git a/include/NumericalConstants.hh b/include/NumericalConstants.hh index 495a9399..de771270 100644 --- a/include/NumericalConstants.hh +++ b/include/NumericalConstants.hh @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2008 Dynare Team + * Copyright (C) 2003-2009 Dynare Team * * This file is part of Dynare. * @@ -35,7 +35,6 @@ private: //! Map matching constants to their id map<string, int> numConstantsIndex; public: - NumericalConstants(); //! Adds a constant and returns its ID int AddConstant(const string &iConst); //! Get a constant in string form diff --git a/include/ParsingDriver.hh b/include/ParsingDriver.hh index 38ea75a4..d99875b8 100644 --- a/include/ParsingDriver.hh +++ b/include/ParsingDriver.hh @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2008 Dynare Team + * Copyright (C) 2003-2009 Dynare Team * * This file is part of Dynare. * @@ -179,6 +179,10 @@ public: void declare_and_init_model_local_variable(string *name, NodeID rhs); //! Adds a constant to DataTree NodeID add_constant(string *constant); + //! Adds a NaN constant to DataTree + NodeID add_nan_constant(); + //! Adds an Inf constant to DataTree + NodeID add_inf_constant(); //! Adds a model variable to ModelTree and VariableTable NodeID add_model_variable(string *name); //! Adds a model lagged variable to ModelTree and VariableTable -- GitLab