v4 parser: various minor things
git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1410 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
abc824dbdf
commit
5e1d6683ff
|
@ -364,6 +364,7 @@ VariableNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
||||||
double
|
double
|
||||||
VariableNode::eval(const eval_context_type &eval_context) const throw (EvalException)
|
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)
|
/*if (lag != 0)
|
||||||
throw EvalException();*/
|
throw EvalException();*/
|
||||||
eval_context_type::const_iterator it = eval_context.find(make_pair(symb_id, type));
|
eval_context_type::const_iterator it = eval_context.find(make_pair(symb_id, type));
|
||||||
|
@ -1239,15 +1240,13 @@ UnknownFunctionNode::collectEndogenous(NodeID &Id)
|
||||||
double
|
double
|
||||||
UnknownFunctionNode::eval(const eval_context_type &eval_context) const throw (EvalException)
|
UnknownFunctionNode::eval(const eval_context_type &eval_context) const throw (EvalException)
|
||||||
{
|
{
|
||||||
cout << "Unknown function\n";
|
cerr << "UnknownFunctionNode::eval: operation impossible!" << endl;
|
||||||
cout.flush();
|
|
||||||
throw EvalException();
|
throw EvalException();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
UnknownFunctionNode::compile(ofstream &CompileCode, bool lhs_rhs, ExprNodeOutputType output_type, const temporary_terms_type &temporary_terms, map_idx_type map_idx) const
|
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";
|
cerr << "UnknownFunctionNode::compile: operation impossible!" << endl;
|
||||||
cout.flush();
|
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -482,18 +482,6 @@ ParsingDriver::add_period(string *p1)
|
||||||
delete 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
|
void
|
||||||
ParsingDriver::add_value(NodeID value)
|
ParsingDriver::add_value(NodeID value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -205,114 +205,115 @@ namespace yy
|
||||||
MODIFIEDHARMONICMEAN = 333,
|
MODIFIEDHARMONICMEAN = 333,
|
||||||
MOMENTS_VARENDO = 334,
|
MOMENTS_VARENDO = 334,
|
||||||
NAME = 335,
|
NAME = 335,
|
||||||
NOBS = 336,
|
NO_COMPILER = 336,
|
||||||
NOCONSTANT = 337,
|
NOBS = 337,
|
||||||
NOCORR = 338,
|
NOCONSTANT = 338,
|
||||||
NODIAGNOSTIC = 339,
|
NOCORR = 339,
|
||||||
NOFUNCTIONS = 340,
|
NODIAGNOSTIC = 340,
|
||||||
NOGRAPH = 341,
|
NOFUNCTIONS = 341,
|
||||||
NOMOMENTS = 342,
|
NOGRAPH = 342,
|
||||||
NOPRINT = 343,
|
NOMOMENTS = 343,
|
||||||
NORMAL_PDF = 344,
|
NOPRINT = 344,
|
||||||
OBSERVATION_TRENDS = 345,
|
NORMAL_PDF = 345,
|
||||||
OPTIM = 346,
|
OBSERVATION_TRENDS = 346,
|
||||||
OPTIM_WEIGHTS = 347,
|
OPTIM = 347,
|
||||||
ORDER = 348,
|
OPTIM_WEIGHTS = 348,
|
||||||
OSR = 349,
|
ORDER = 349,
|
||||||
OSR_PARAMS = 350,
|
OSR = 350,
|
||||||
PARAMETERS = 351,
|
OSR_PARAMS = 351,
|
||||||
PERIODS = 352,
|
PARAMETERS = 352,
|
||||||
PLANNER_OBJECTIVE = 353,
|
PERIODS = 353,
|
||||||
PREFILTER = 354,
|
PLANNER_OBJECTIVE = 354,
|
||||||
PRESAMPLE = 355,
|
PREFILTER = 355,
|
||||||
PRINT = 356,
|
PRESAMPLE = 356,
|
||||||
PRIOR_TRUNC = 357,
|
PRINT = 357,
|
||||||
PRIOR_ANALYSIS = 358,
|
PRIOR_TRUNC = 358,
|
||||||
POSTERIOR_ANALYSIS = 359,
|
PRIOR_ANALYSIS = 359,
|
||||||
QZ_CRITERIUM = 360,
|
POSTERIOR_ANALYSIS = 360,
|
||||||
RELATIVE_IRF = 361,
|
QZ_CRITERIUM = 361,
|
||||||
REPLIC = 362,
|
RELATIVE_IRF = 362,
|
||||||
RPLOT = 363,
|
REPLIC = 363,
|
||||||
SHOCKS = 364,
|
RPLOT = 364,
|
||||||
SIGMA_E = 365,
|
SHOCKS = 365,
|
||||||
SIMUL = 366,
|
SIGMA_E = 366,
|
||||||
SIMUL_ALGO = 367,
|
SIMUL = 367,
|
||||||
SIMUL_SEED = 368,
|
SIMUL_ALGO = 368,
|
||||||
SMOOTHER = 369,
|
SIMUL_SEED = 369,
|
||||||
SOLVE_ALGO = 370,
|
SMOOTHER = 370,
|
||||||
SPARSE_DLL = 371,
|
SOLVE_ALGO = 371,
|
||||||
STDERR = 372,
|
SPARSE_DLL = 372,
|
||||||
STEADY = 373,
|
STDERR = 373,
|
||||||
STOCH_SIMUL = 374,
|
STEADY = 374,
|
||||||
TEX = 375,
|
STOCH_SIMUL = 375,
|
||||||
RAMSEY_POLICY = 376,
|
TEX = 376,
|
||||||
PLANNER_DISCOUNT = 377,
|
RAMSEY_POLICY = 377,
|
||||||
TEX_NAME = 378,
|
PLANNER_DISCOUNT = 378,
|
||||||
UNIFORM_PDF = 379,
|
TEX_NAME = 379,
|
||||||
UNIT_ROOT_VARS = 380,
|
UNIFORM_PDF = 380,
|
||||||
USE_DLL = 381,
|
UNIT_ROOT_VARS = 381,
|
||||||
VALUES = 382,
|
USE_DLL = 382,
|
||||||
VAR = 383,
|
VALUES = 383,
|
||||||
VAREXO = 384,
|
VAR = 384,
|
||||||
VAREXO_DET = 385,
|
VAREXO = 385,
|
||||||
VAROBS = 386,
|
VAREXO_DET = 386,
|
||||||
XLS_SHEET = 387,
|
VAROBS = 387,
|
||||||
XLS_RANGE = 388,
|
XLS_SHEET = 388,
|
||||||
COMMA = 389,
|
XLS_RANGE = 389,
|
||||||
MINUS = 390,
|
COMMA = 390,
|
||||||
PLUS = 391,
|
MINUS = 391,
|
||||||
DIVIDE = 392,
|
PLUS = 392,
|
||||||
TIMES = 393,
|
DIVIDE = 393,
|
||||||
UMINUS = 394,
|
TIMES = 394,
|
||||||
POWER = 395,
|
UMINUS = 395,
|
||||||
EXP = 396,
|
POWER = 396,
|
||||||
LOG = 397,
|
EXP = 397,
|
||||||
LOG10 = 398,
|
LOG = 398,
|
||||||
SIN = 399,
|
LOG10 = 399,
|
||||||
COS = 400,
|
SIN = 400,
|
||||||
TAN = 401,
|
COS = 401,
|
||||||
ASIN = 402,
|
TAN = 402,
|
||||||
ACOS = 403,
|
ASIN = 403,
|
||||||
ATAN = 404,
|
ACOS = 404,
|
||||||
SINH = 405,
|
ATAN = 405,
|
||||||
COSH = 406,
|
SINH = 406,
|
||||||
TANH = 407,
|
COSH = 407,
|
||||||
ASINH = 408,
|
TANH = 408,
|
||||||
ACOSH = 409,
|
ASINH = 409,
|
||||||
ATANH = 410,
|
ACOSH = 410,
|
||||||
SQRT = 411,
|
ATANH = 411,
|
||||||
DYNARE_SENSITIVITY = 412,
|
SQRT = 412,
|
||||||
IDENTIFICATION = 413,
|
DYNARE_SENSITIVITY = 413,
|
||||||
MORRIS = 414,
|
IDENTIFICATION = 414,
|
||||||
STAB = 415,
|
MORRIS = 415,
|
||||||
REDFORM = 416,
|
STAB = 416,
|
||||||
PPRIOR = 417,
|
REDFORM = 417,
|
||||||
PRIOR_RANGE = 418,
|
PPRIOR = 418,
|
||||||
PPOST = 419,
|
PRIOR_RANGE = 419,
|
||||||
ILPTAU = 420,
|
PPOST = 420,
|
||||||
GLUE = 421,
|
ILPTAU = 421,
|
||||||
MORRIS_NLIV = 422,
|
GLUE = 422,
|
||||||
MORRIS_NTRA = 423,
|
MORRIS_NLIV = 423,
|
||||||
NSAM = 424,
|
MORRIS_NTRA = 424,
|
||||||
LOAD_REDFORM = 425,
|
NSAM = 425,
|
||||||
LOAD_RMSE = 426,
|
LOAD_REDFORM = 426,
|
||||||
LOAD_STAB = 427,
|
LOAD_RMSE = 427,
|
||||||
ALPHA2_STAB = 428,
|
LOAD_STAB = 428,
|
||||||
KSSTAT = 429,
|
ALPHA2_STAB = 429,
|
||||||
LOGTRANS_REDFORM = 430,
|
KSSTAT = 430,
|
||||||
THRESHOLD_REDFORM = 431,
|
LOGTRANS_REDFORM = 431,
|
||||||
KSSTAT_REDFORM = 432,
|
THRESHOLD_REDFORM = 432,
|
||||||
ALPHA2_REDFORM = 433,
|
KSSTAT_REDFORM = 433,
|
||||||
NAMENDO = 434,
|
ALPHA2_REDFORM = 434,
|
||||||
NAMLAGENDO = 435,
|
NAMENDO = 435,
|
||||||
NAMEXO = 436,
|
NAMLAGENDO = 436,
|
||||||
RMSE = 437,
|
NAMEXO = 437,
|
||||||
LIK_ONLY = 438,
|
RMSE = 438,
|
||||||
VAR_RMSE = 439,
|
LIK_ONLY = 439,
|
||||||
PFILT_RMSE = 440,
|
VAR_RMSE = 440,
|
||||||
ISTART_RMSE = 441,
|
PFILT_RMSE = 441,
|
||||||
ALPHA_RMSE = 442,
|
ISTART_RMSE = 442,
|
||||||
ALPHA2_RMSE = 443
|
ALPHA_RMSE = 443,
|
||||||
|
ALPHA2_RMSE = 444
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -189,7 +189,7 @@ public:
|
||||||
/*EndNew*/
|
/*EndNew*/
|
||||||
};
|
};
|
||||||
|
|
||||||
/*enum UnaryOpcode
|
enum UnaryOpcode
|
||||||
{
|
{
|
||||||
oUminus,
|
oUminus,
|
||||||
oExp,
|
oExp,
|
||||||
|
@ -209,7 +209,7 @@ public:
|
||||||
oAtanh,
|
oAtanh,
|
||||||
oSqrt
|
oSqrt
|
||||||
};
|
};
|
||||||
*/
|
|
||||||
//! Unary operator node
|
//! Unary operator node
|
||||||
class UnaryOpNode : public ExprNode
|
class UnaryOpNode : public ExprNode
|
||||||
{
|
{
|
||||||
|
@ -238,7 +238,6 @@ public:
|
||||||
/*EndNew*/
|
/*EndNew*/
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
enum BinaryOpcode
|
enum BinaryOpcode
|
||||||
{
|
{
|
||||||
oPlus,
|
oPlus,
|
||||||
|
@ -248,7 +247,7 @@ enum BinaryOpcode
|
||||||
oPower,
|
oPower,
|
||||||
oEqual
|
oEqual
|
||||||
};
|
};
|
||||||
*/
|
|
||||||
//! Binary operator node
|
//! Binary operator node
|
||||||
class BinaryOpNode : public ExprNode
|
class BinaryOpNode : public ExprNode
|
||||||
{
|
{
|
||||||
|
|
|
@ -103,6 +103,11 @@ private:
|
||||||
void writeSparseDLLDynamicHFile(const string &dynamic_basename) const;
|
void writeSparseDLLDynamicHFile(const string &dynamic_basename) const;
|
||||||
//! Writes dynamic model file when SparseDLL option is on
|
//! Writes dynamic model file when SparseDLL option is on
|
||||||
void writeSparseDLLDynamicCFileAndBinFile(const string &dynamic_basename, const string &bin_basename, ExprNodeOutputType output_type) const;
|
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 evaluateJacobian(const eval_context_type &eval_context, jacob_map *j_m);
|
||||||
void BlockLinear(Model_Block *ModelBlock);
|
void BlockLinear(Model_Block *ModelBlock);
|
||||||
string reform(string name) const;
|
string reform(string name) const;
|
||||||
|
@ -120,8 +125,7 @@ public:
|
||||||
double cutoff;
|
double cutoff;
|
||||||
//! The weight of the Markowitz criteria to determine the pivot in the linear solver (simul_NG1 from simulate.cc)
|
//! The weight of the Markowitz criteria to determine the pivot in the linear solver (simul_NG1 from simulate.cc)
|
||||||
double markowitz;
|
double markowitz;
|
||||||
//! Use a graphical and symbolic version of the symbolic gaussian elimination new_SGE = false
|
//! Use a graphical and symbolic version of the symbolic gaussian elimination (new_SGE = false) or use direct gaussian elimination (new_SGE = true)
|
||||||
//! or use direct gaussian elimination new_SGE = true
|
|
||||||
bool new_SGE;
|
bool new_SGE;
|
||||||
//! the file containing the model and the derivatives code
|
//! the file containing the model and the derivatives code
|
||||||
ofstream code_file;
|
ofstream code_file;
|
||||||
|
@ -149,8 +153,8 @@ public:
|
||||||
//! Complete set to block decompose the model
|
//! Complete set to block decompose the model
|
||||||
BlockTriangular block_triangular;
|
BlockTriangular block_triangular;
|
||||||
//! Adds informations for simulation in a binary file
|
//! 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,
|
void Write_Inf_To_Bin_File(const string &dynamic_basename, const string &bin_basename,
|
||||||
int &u_count_int, bool &file_open) const;
|
const int &num, int &u_count_int, bool &file_open) const;
|
||||||
|
|
||||||
int equation_number() const;
|
int equation_number() const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -217,11 +217,7 @@ public:
|
||||||
void add_period(string *p1, string *p2);
|
void add_period(string *p1, string *p2);
|
||||||
//! Adds a shock period
|
//! Adds a shock period
|
||||||
void add_period(string *p1);
|
void add_period(string *p1);
|
||||||
//! Adds a shock value (when only a numerical constant)
|
//! Adds a deterministic shock value
|
||||||
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)
|
|
||||||
void add_value(NodeID value);
|
void add_value(NodeID value);
|
||||||
//! Writes a Sigma_e block
|
//! Writes a Sigma_e block
|
||||||
void do_sigma_e();
|
void do_sigma_e();
|
||||||
|
|
|
@ -1,38 +1,6 @@
|
||||||
#ifndef _SYMBOLTABLETYPES_HH
|
#ifndef _SYMBOLTABLETYPES_HH
|
||||||
#define _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
|
//! Symbol type enum
|
||||||
enum Type
|
enum Type
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue