diff --git a/ComputingTasks.cc b/ComputingTasks.cc index fe4cf85c5835704fd42d07ee3141fbd5fa90aa38..b8b9b6a9b675c2e1d32445cdab5a6994ee5f6c84 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 487646ac967fe04ec43278cecdffbc6eed8f1397..7fd99f079b616e415a17b15ca17419ff3905d2fe 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 a294e3393bd228649c2db6b2c9e3b88025537309..3dbc60a97e1bcb61bd080582c70dc59b4d7df3c3 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 980f2b6706406ec1274012ce89dcab869e110279..8f894e7d03a9eb8ead9d5880b0871fa959a8cbc8 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 7f743023123ffaa3b46e0dbbe7c8ba44a4082857..3c89d5f79f3a000f00e1b45acf39d14f86fce5a4 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 3a4367d0e4f4af69d111ab33455340130a4bf6a3..0ab9fe5002cf0340bc0d5e23d50fb8bb6b15053b 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 27a71994bd81d858cb4fe6902d0f80226dff5b4c..0699bcaeb3dc1ce20f4a757925f721fc41615868 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 e2029553a9876f6dca7fc539543cff4cc51b6233..db77f657b9a92fce77339d015449f49c14f69c4e 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 495a9399031594f0b5930b872837b6fbf56d3d52..de7712709404ce2b5c5053b66f4b2dd57848c598 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 38ea75a450ebb25e51219616abab2ab734e71144..d99875b8f6bd3b4d2a173f3c65b04e99f5d3466b 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