v4 parser: various minor things

git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1410 ac1d8469-bf42-47a9-8791-bf33cf982152
time-shift
sebastien 2007-10-04 09:16:52 +00:00
parent abc824dbdf
commit 5e1d6683ff
7 changed files with 124 additions and 169 deletions

View File

@ -364,6 +364,7 @@ VariableNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
double
VariableNode::eval(const eval_context_type &eval_context) const throw (EvalException)
{
// ModelTree::evaluateJacobian need to have the initval values applied to lead/lagged variables also
/*if (lag != 0)
throw EvalException();*/
eval_context_type::const_iterator it = eval_context.find(make_pair(symb_id, type));
@ -1239,15 +1240,13 @@ UnknownFunctionNode::collectEndogenous(NodeID &Id)
double
UnknownFunctionNode::eval(const eval_context_type &eval_context) const throw (EvalException)
{
cout << "Unknown function\n";
cout.flush();
cerr << "UnknownFunctionNode::eval: operation impossible!" << endl;
throw EvalException();
}
void
UnknownFunctionNode::compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const
{
cout << "Unknown function\n";
cout.flush();
cerr << "UnknownFunctionNode::compile: operation impossible!" << endl;
exit(-1);
}

View File

@ -482,18 +482,6 @@ ParsingDriver::add_period(string *p1)
delete p1;
}
void
ParsingDriver::add_value_const(string *value)
{
add_value(add_constant(value));
}
void
ParsingDriver::add_value_var(string *name)
{
add_value(add_expression_variable(name));
}
void
ParsingDriver::add_value(NodeID value)
{

View File

@ -205,114 +205,115 @@ namespace yy
MODIFIEDHARMONICMEAN = 333,
MOMENTS_VARENDO = 334,
NAME = 335,
NOBS = 336,
NOCONSTANT = 337,
NOCORR = 338,
NODIAGNOSTIC = 339,
NOFUNCTIONS = 340,
NOGRAPH = 341,
NOMOMENTS = 342,
NOPRINT = 343,
NORMAL_PDF = 344,
OBSERVATION_TRENDS = 345,
OPTIM = 346,
OPTIM_WEIGHTS = 347,
ORDER = 348,
OSR = 349,
OSR_PARAMS = 350,
PARAMETERS = 351,
PERIODS = 352,
PLANNER_OBJECTIVE = 353,
PREFILTER = 354,
PRESAMPLE = 355,
PRINT = 356,
PRIOR_TRUNC = 357,
PRIOR_ANALYSIS = 358,
POSTERIOR_ANALYSIS = 359,
QZ_CRITERIUM = 360,
RELATIVE_IRF = 361,
REPLIC = 362,
RPLOT = 363,
SHOCKS = 364,
SIGMA_E = 365,
SIMUL = 366,
SIMUL_ALGO = 367,
SIMUL_SEED = 368,
SMOOTHER = 369,
SOLVE_ALGO = 370,
SPARSE_DLL = 371,
STDERR = 372,
STEADY = 373,
STOCH_SIMUL = 374,
TEX = 375,
RAMSEY_POLICY = 376,
PLANNER_DISCOUNT = 377,
TEX_NAME = 378,
UNIFORM_PDF = 379,
UNIT_ROOT_VARS = 380,
USE_DLL = 381,
VALUES = 382,
VAR = 383,
VAREXO = 384,
VAREXO_DET = 385,
VAROBS = 386,
XLS_SHEET = 387,
XLS_RANGE = 388,
COMMA = 389,
MINUS = 390,
PLUS = 391,
DIVIDE = 392,
TIMES = 393,
UMINUS = 394,
POWER = 395,
EXP = 396,
LOG = 397,
LOG10 = 398,
SIN = 399,
COS = 400,
TAN = 401,
ASIN = 402,
ACOS = 403,
ATAN = 404,
SINH = 405,
COSH = 406,
TANH = 407,
ASINH = 408,
ACOSH = 409,
ATANH = 410,
SQRT = 411,
DYNARE_SENSITIVITY = 412,
IDENTIFICATION = 413,
MORRIS = 414,
STAB = 415,
REDFORM = 416,
PPRIOR = 417,
PRIOR_RANGE = 418,
PPOST = 419,
ILPTAU = 420,
GLUE = 421,
MORRIS_NLIV = 422,
MORRIS_NTRA = 423,
NSAM = 424,
LOAD_REDFORM = 425,
LOAD_RMSE = 426,
LOAD_STAB = 427,
ALPHA2_STAB = 428,
KSSTAT = 429,
LOGTRANS_REDFORM = 430,
THRESHOLD_REDFORM = 431,
KSSTAT_REDFORM = 432,
ALPHA2_REDFORM = 433,
NAMENDO = 434,
NAMLAGENDO = 435,
NAMEXO = 436,
RMSE = 437,
LIK_ONLY = 438,
VAR_RMSE = 439,
PFILT_RMSE = 440,
ISTART_RMSE = 441,
ALPHA_RMSE = 442,
ALPHA2_RMSE = 443
NO_COMPILER = 336,
NOBS = 337,
NOCONSTANT = 338,
NOCORR = 339,
NODIAGNOSTIC = 340,
NOFUNCTIONS = 341,
NOGRAPH = 342,
NOMOMENTS = 343,
NOPRINT = 344,
NORMAL_PDF = 345,
OBSERVATION_TRENDS = 346,
OPTIM = 347,
OPTIM_WEIGHTS = 348,
ORDER = 349,
OSR = 350,
OSR_PARAMS = 351,
PARAMETERS = 352,
PERIODS = 353,
PLANNER_OBJECTIVE = 354,
PREFILTER = 355,
PRESAMPLE = 356,
PRINT = 357,
PRIOR_TRUNC = 358,
PRIOR_ANALYSIS = 359,
POSTERIOR_ANALYSIS = 360,
QZ_CRITERIUM = 361,
RELATIVE_IRF = 362,
REPLIC = 363,
RPLOT = 364,
SHOCKS = 365,
SIGMA_E = 366,
SIMUL = 367,
SIMUL_ALGO = 368,
SIMUL_SEED = 369,
SMOOTHER = 370,
SOLVE_ALGO = 371,
SPARSE_DLL = 372,
STDERR = 373,
STEADY = 374,
STOCH_SIMUL = 375,
TEX = 376,
RAMSEY_POLICY = 377,
PLANNER_DISCOUNT = 378,
TEX_NAME = 379,
UNIFORM_PDF = 380,
UNIT_ROOT_VARS = 381,
USE_DLL = 382,
VALUES = 383,
VAR = 384,
VAREXO = 385,
VAREXO_DET = 386,
VAROBS = 387,
XLS_SHEET = 388,
XLS_RANGE = 389,
COMMA = 390,
MINUS = 391,
PLUS = 392,
DIVIDE = 393,
TIMES = 394,
UMINUS = 395,
POWER = 396,
EXP = 397,
LOG = 398,
LOG10 = 399,
SIN = 400,
COS = 401,
TAN = 402,
ASIN = 403,
ACOS = 404,
ATAN = 405,
SINH = 406,
COSH = 407,
TANH = 408,
ASINH = 409,
ACOSH = 410,
ATANH = 411,
SQRT = 412,
DYNARE_SENSITIVITY = 413,
IDENTIFICATION = 414,
MORRIS = 415,
STAB = 416,
REDFORM = 417,
PPRIOR = 418,
PRIOR_RANGE = 419,
PPOST = 420,
ILPTAU = 421,
GLUE = 422,
MORRIS_NLIV = 423,
MORRIS_NTRA = 424,
NSAM = 425,
LOAD_REDFORM = 426,
LOAD_RMSE = 427,
LOAD_STAB = 428,
ALPHA2_STAB = 429,
KSSTAT = 430,
LOGTRANS_REDFORM = 431,
THRESHOLD_REDFORM = 432,
KSSTAT_REDFORM = 433,
ALPHA2_REDFORM = 434,
NAMENDO = 435,
NAMLAGENDO = 436,
NAMEXO = 437,
RMSE = 438,
LIK_ONLY = 439,
VAR_RMSE = 440,
PFILT_RMSE = 441,
ISTART_RMSE = 442,
ALPHA_RMSE = 443,
ALPHA2_RMSE = 444
};
};

View File

@ -189,7 +189,7 @@ public:
/*EndNew*/
};
/*enum UnaryOpcode
enum UnaryOpcode
{
oUminus,
oExp,
@ -209,7 +209,7 @@ public:
oAtanh,
oSqrt
};
*/
//! Unary operator node
class UnaryOpNode : public ExprNode
{
@ -238,7 +238,6 @@ public:
/*EndNew*/
};
/*
enum BinaryOpcode
{
oPlus,
@ -248,7 +247,7 @@ enum BinaryOpcode
oPower,
oEqual
};
*/
//! Binary operator node
class BinaryOpNode : public ExprNode
{

View File

@ -103,6 +103,11 @@ private:
void writeSparseDLLDynamicHFile(const string &dynamic_basename) const;
//! Writes dynamic model file when SparseDLL option is on
void writeSparseDLLDynamicCFileAndBinFile(const string &dynamic_basename, const string &bin_basename, ExprNodeOutputType output_type) const;
//! Computes jacobian and prepares for equation normalization
/*! Using values from initval/endval blocks and parameter initializations:
- computes the jacobian for the model w.r. to contemporaneous variables
- removes edges of the incidence matrix when derivative w.r. to the corresponding variable is too close to zero (below the cutoff)
*/
void evaluateJacobian(const eval_context_type &eval_context, jacob_map *j_m);
void BlockLinear(Model_Block *ModelBlock);
string reform(string name) const;
@ -120,8 +125,7 @@ public:
double cutoff;
//! The weight of the Markowitz criteria to determine the pivot in the linear solver (simul_NG1 from simulate.cc)
double markowitz;
//! Use a graphical and symbolic version of the symbolic gaussian elimination new_SGE = false
//! or use direct gaussian elimination new_SGE = true
//! Use a graphical and symbolic version of the symbolic gaussian elimination (new_SGE = false) or use direct gaussian elimination (new_SGE = true)
bool new_SGE;
//! the file containing the model and the derivatives code
ofstream code_file;
@ -149,8 +153,8 @@ public:
//! Complete set to block decompose the model
BlockTriangular block_triangular;
//! Adds informations for simulation in a binary file
void Write_Inf_To_Bin_File(const string &dynamic_basename, const string &bin_basename, const int &num,
int &u_count_int, bool &file_open) const;
void Write_Inf_To_Bin_File(const string &dynamic_basename, const string &bin_basename,
const int &num, int &u_count_int, bool &file_open) const;
int equation_number() const;
};

View File

@ -217,11 +217,7 @@ public:
void add_period(string *p1, string *p2);
//! Adds a shock period
void add_period(string *p1);
//! Adds a shock value (when only a numerical constant)
void add_value_const(string *value);
//! Adds a shock value (when only a variable name)
void add_value_var(string *name);
//! Adds a shock value (when it is a complete expression)
//! Adds a deterministic shock value
void add_value(NodeID value);
//! Writes a Sigma_e block
void do_sigma_e();

View File

@ -1,38 +1,6 @@
#ifndef _SYMBOLTABLETYPES_HH
#define _SYMBOLTABLETYPES_HH
enum UnaryOpcode
{
oUminus,
oExp,
oLog,
oLog10,
oCos,
oSin,
oTan,
oAcos,
oAsin,
oAtan,
oCosh,
oSinh,
oTanh,
oAcosh,
oAsinh,
oAtanh,
oSqrt
};
enum BinaryOpcode
{
oPlus,
oMinus,
oTimes,
oDivide,
oPower,
oEqual
};
//! Symbol type enum
enum Type
{