Gets rid of dummy function (replaced by logical operators) and corrects logical operators.
git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1427 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
020035a81b
commit
a5323768aa
|
@ -367,12 +367,6 @@ DataTree::AddMin(NodeID iArg1, NodeID iArg2)
|
|||
return AddBinaryOp(iArg1, oMin, iArg2);
|
||||
}
|
||||
|
||||
NodeID
|
||||
DataTree::AddDuMmY(NodeID iArg1)
|
||||
{
|
||||
return AddUnaryOp(oDummy,iArg1);
|
||||
}
|
||||
|
||||
NodeID
|
||||
DataTree::AddEqual(NodeID iArg1, NodeID iArg2)
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -40,7 +40,7 @@ class ParsingDriver;
|
|||
%token BVAR_PRIOR_MU BVAR_PRIOR_OMEGA BVAR_PRIOR_TAU BVAR_PRIOR_TRAIN
|
||||
%token BVAR_REPLIC
|
||||
%token CALIB CALIB_VAR CHECK CONF_SIG CONSTANT CORR COVAR CUTOFF
|
||||
%token DATAFILE DR_ALGO DROP DSAMPLE DUMMY DYNASAVE DYNATYPE
|
||||
%token DATAFILE DR_ALGO DROP DSAMPLE DYNASAVE DYNATYPE
|
||||
%token END ENDVAL EQUAL ESTIMATION ESTIMATED_PARAMS ESTIMATED_PARAMS_BOUNDS ESTIMATED_PARAMS_INIT
|
||||
%token FILENAME FILTER_STEP_AHEAD FILTERED_VARS FIRST_OBS
|
||||
%token <string_val> FLOAT_NUMBER
|
||||
|
@ -294,8 +294,6 @@ expression : '(' expression ')'
|
|||
{ $$ = driver.add_atan($3); }
|
||||
| SQRT '(' expression ')'
|
||||
{ $$ = driver.add_sqrt($3); }
|
||||
| DUMMY '(' expression ')'
|
||||
{ $$ = driver.add_dummy($3); }
|
||||
| MAX '(' expression COMMA expression ')'
|
||||
{ $$ = driver.add_max($3 , $5); }
|
||||
| MIN '(' expression COMMA expression ')'
|
||||
|
@ -426,8 +424,6 @@ hand_side : '(' hand_side ')'
|
|||
{ $$ = driver.add_atan($3); }
|
||||
| SQRT '(' hand_side ')'
|
||||
{ $$ = driver.add_sqrt($3); }
|
||||
| DUMMY '(' hand_side ')'
|
||||
{ $$ = driver.add_dummy($3); }
|
||||
| MAX '(' hand_side COMMA hand_side ')'
|
||||
{ $$ = driver.add_max($3 , $5); }
|
||||
| MIN '(' hand_side COMMA hand_side ')'
|
||||
|
|
|
@ -270,7 +270,6 @@ int sigma_e = 0;
|
|||
<DYNARE_STATEMENT,DYNARE_BLOCK>sqrt {return token::SQRT;}
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>max {return token::MAX;}
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>min {return token::MIN;}
|
||||
<DYNARE_STATEMENT,DYNARE_BLOCK>dummy {return token::DUMMY;}
|
||||
|
||||
/* options for GSA module by Marco Ratto */
|
||||
<DYNARE_STATEMENT>identification {return token::IDENTIFICATION;}
|
||||
|
|
|
@ -521,8 +521,6 @@ UnaryOpNode::computeDerivative(int varID)
|
|||
case oSqrt:
|
||||
t11 = datatree.AddPlus(this, this);
|
||||
return datatree.AddDivide(darg, t11);
|
||||
case oDummy:
|
||||
return datatree.Zero;
|
||||
}
|
||||
cerr << "Impossible case!" << endl;
|
||||
exit(-1);
|
||||
|
@ -574,8 +572,6 @@ UnaryOpNode::cost(const temporary_terms_type &temporary_terms, bool is_matlab) c
|
|||
return cost + 350;
|
||||
case oSqrt:
|
||||
return cost + 570;
|
||||
case oDummy:
|
||||
return cost + 200;
|
||||
}
|
||||
else
|
||||
// Cost for C files
|
||||
|
@ -610,8 +606,6 @@ UnaryOpNode::cost(const temporary_terms_type &temporary_terms, bool is_matlab) c
|
|||
return cost + 150;
|
||||
case oSqrt:
|
||||
return cost + 90;
|
||||
case oDummy:
|
||||
return cost + 50;
|
||||
}
|
||||
cerr << "Impossible case!" << endl;
|
||||
exit(-1);
|
||||
|
@ -680,16 +674,6 @@ UnaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
|||
return;
|
||||
}
|
||||
|
||||
if (op_code == oDummy)
|
||||
{
|
||||
if (OFFSET(output_type))
|
||||
output << "double";
|
||||
output << "(";
|
||||
arg->writeOutput(output, output_type, temporary_terms);
|
||||
output << ">0)";
|
||||
return;
|
||||
}
|
||||
|
||||
// Always put parenthesis around uminus nodes
|
||||
if (op_code == oUminus)
|
||||
output << "(";
|
||||
|
@ -816,8 +800,6 @@ UnaryOpNode::eval_opcode(UnaryOpcode op_code, double v) throw (EvalException)
|
|||
return(atanh(v));
|
||||
case oSqrt:
|
||||
return(sqrt(v));
|
||||
case oDummy:
|
||||
return(double (v>0));
|
||||
}
|
||||
// Impossible
|
||||
throw EvalException();
|
||||
|
@ -928,19 +910,17 @@ BinaryOpNode::computeDerivative(int varID)
|
|||
return datatree.AddTimes(t15, this);
|
||||
}
|
||||
case oMax:
|
||||
t11 = datatree.AddMinus(arg1,arg2);
|
||||
t12 = datatree.AddDuMmY(t11);
|
||||
t13 = datatree.AddTimes(t12,darg1);
|
||||
t14 = datatree.AddMinus(datatree.One,t12);
|
||||
t15 = datatree.AddTimes(t14,darg2);
|
||||
return datatree.AddPlus(t15,t13);
|
||||
t11 = datatree.AddGreater(arg1,arg2);
|
||||
t12 = datatree.AddTimes(t11,darg1);
|
||||
t13 = datatree.AddMinus(datatree.One,t11);
|
||||
t14 = datatree.AddTimes(t13,darg2);
|
||||
return datatree.AddPlus(t14,t12);
|
||||
case oMin:
|
||||
t11 = datatree.AddMinus(arg2,arg1);
|
||||
t12 = datatree.AddDuMmY(t11);
|
||||
t13 = datatree.AddTimes(t12,darg1);
|
||||
t14 = datatree.AddMinus(datatree.One,t12);
|
||||
t15 = datatree.AddTimes(t14,darg2);
|
||||
return datatree.AddPlus(t15,t13);
|
||||
t11 = datatree.AddGreater(arg2,arg1);
|
||||
t12 = datatree.AddTimes(t11,darg1);
|
||||
t13 = datatree.AddMinus(datatree.One,t11);
|
||||
t14 = datatree.AddTimes(t13,darg2);
|
||||
return datatree.AddPlus(t14,t12);
|
||||
case oEqual:
|
||||
return datatree.AddMinus(darg1, darg2);
|
||||
}
|
||||
|
@ -1264,6 +1244,9 @@ BinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
|
|||
output << "==";
|
||||
break;
|
||||
case oDifferent:
|
||||
if(OFFSET(output_type))
|
||||
output << "~=";
|
||||
else
|
||||
output << "!=";
|
||||
break;
|
||||
case oEqual:
|
||||
|
|
|
@ -1200,12 +1200,6 @@ ParsingDriver::add_min(NodeID arg1, NodeID arg2)
|
|||
return data_tree->AddMin(arg1,arg2);
|
||||
}
|
||||
|
||||
NodeID
|
||||
ParsingDriver::add_dummy(NodeID arg1)
|
||||
{
|
||||
return data_tree->AddDuMmY(arg1);
|
||||
}
|
||||
|
||||
void
|
||||
ParsingDriver::add_unknown_function_arg(NodeID arg)
|
||||
{
|
||||
|
|
|
@ -125,8 +125,6 @@ public:
|
|||
NodeID AddMaX(NodeID iArg1, NodeID iArg2);
|
||||
//! Adds "min(arg1,arg2)" to model tree
|
||||
NodeID AddMin(NodeID iArg1, NodeID iArg2);
|
||||
//! Adds "dummy(arg1)" to model tree
|
||||
NodeID AddDuMmY(NodeID iArg1);
|
||||
//! Adds "arg1=arg2" to model tree
|
||||
NodeID AddEqual(NodeID iArg1, NodeID iArg2);
|
||||
void AddLocalParameter(const string &name, NodeID value) throw (LocalParameterException);
|
||||
|
|
|
@ -153,177 +153,176 @@ namespace yy
|
|||
DR_ALGO = 281,
|
||||
DROP = 282,
|
||||
DSAMPLE = 283,
|
||||
DUMMY = 284,
|
||||
DYNASAVE = 285,
|
||||
DYNATYPE = 286,
|
||||
END = 287,
|
||||
ENDVAL = 288,
|
||||
EQUAL = 289,
|
||||
ESTIMATION = 290,
|
||||
ESTIMATED_PARAMS = 291,
|
||||
ESTIMATED_PARAMS_BOUNDS = 292,
|
||||
ESTIMATED_PARAMS_INIT = 293,
|
||||
FILENAME = 294,
|
||||
FILTER_STEP_AHEAD = 295,
|
||||
FILTERED_VARS = 296,
|
||||
FIRST_OBS = 297,
|
||||
FLOAT_NUMBER = 298,
|
||||
FORECAST = 299,
|
||||
GAMMA_PDF = 300,
|
||||
GCC_COMPILER = 301,
|
||||
GRAPH = 302,
|
||||
HISTVAL = 303,
|
||||
HP_FILTER = 304,
|
||||
HP_NGRID = 305,
|
||||
INITVAL = 306,
|
||||
INT_NUMBER = 307,
|
||||
INV_GAMMA_PDF = 308,
|
||||
IRF = 309,
|
||||
KALMAN_ALGO = 310,
|
||||
KALMAN_TOL = 311,
|
||||
LAPLACE = 312,
|
||||
LCC_COMPILER = 313,
|
||||
LIK_ALGO = 314,
|
||||
LIK_INIT = 315,
|
||||
LINEAR = 316,
|
||||
LOAD_MH_FILE = 317,
|
||||
LOGLINEAR = 318,
|
||||
MARKOWITZ = 319,
|
||||
MAX = 320,
|
||||
MH_DROP = 321,
|
||||
MH_INIT_SCALE = 322,
|
||||
MH_JSCALE = 323,
|
||||
MH_MODE = 324,
|
||||
MH_NBLOCKS = 325,
|
||||
MH_REPLIC = 326,
|
||||
MH_RECOVER = 327,
|
||||
MIN = 328,
|
||||
MODE_CHECK = 329,
|
||||
MODE_COMPUTE = 330,
|
||||
MODE_FILE = 331,
|
||||
MODEL = 332,
|
||||
MODEL_COMPARISON = 333,
|
||||
MSHOCKS = 334,
|
||||
MODEL_COMPARISON_APPROXIMATION = 335,
|
||||
MODIFIEDHARMONICMEAN = 336,
|
||||
MOMENTS_VARENDO = 337,
|
||||
NAME = 338,
|
||||
NO_COMPILER = 339,
|
||||
NOBS = 340,
|
||||
NOCONSTANT = 341,
|
||||
NOCORR = 342,
|
||||
NODIAGNOSTIC = 343,
|
||||
NOFUNCTIONS = 344,
|
||||
NOGRAPH = 345,
|
||||
NOMOMENTS = 346,
|
||||
NOPRINT = 347,
|
||||
NORMAL_PDF = 348,
|
||||
OBSERVATION_TRENDS = 349,
|
||||
OPTIM = 350,
|
||||
OPTIM_WEIGHTS = 351,
|
||||
ORDER = 352,
|
||||
OSR = 353,
|
||||
OSR_PARAMS = 354,
|
||||
PARAMETERS = 355,
|
||||
PERIODS = 356,
|
||||
PLANNER_OBJECTIVE = 357,
|
||||
PREFILTER = 358,
|
||||
PRESAMPLE = 359,
|
||||
PRINT = 360,
|
||||
PRIOR_TRUNC = 361,
|
||||
PRIOR_ANALYSIS = 362,
|
||||
POSTERIOR_ANALYSIS = 363,
|
||||
QZ_CRITERIUM = 364,
|
||||
RELATIVE_IRF = 365,
|
||||
REPLIC = 366,
|
||||
RPLOT = 367,
|
||||
SHOCKS = 368,
|
||||
SIGMA_E = 369,
|
||||
SIMUL = 370,
|
||||
SIMUL_ALGO = 371,
|
||||
SIMUL_SEED = 372,
|
||||
SMOOTHER = 373,
|
||||
SOLVE_ALGO = 374,
|
||||
SPARSE_DLL = 375,
|
||||
STDERR = 376,
|
||||
STEADY = 377,
|
||||
STOCH_SIMUL = 378,
|
||||
TEX = 379,
|
||||
RAMSEY_POLICY = 380,
|
||||
PLANNER_DISCOUNT = 381,
|
||||
TEX_NAME = 382,
|
||||
UNIFORM_PDF = 383,
|
||||
UNIT_ROOT_VARS = 384,
|
||||
USE_DLL = 385,
|
||||
VALUES = 386,
|
||||
VAR = 387,
|
||||
VAREXO = 388,
|
||||
VAREXO_DET = 389,
|
||||
VAROBS = 390,
|
||||
XLS_SHEET = 391,
|
||||
XLS_RANGE = 392,
|
||||
COMMA = 393,
|
||||
GREATER = 394,
|
||||
LESS = 395,
|
||||
EXCLAMATION_EQUAL = 396,
|
||||
EXCLAMATION = 397,
|
||||
EQUAL_EQUAL = 398,
|
||||
GREATER_EQUAL = 399,
|
||||
LESS_EQUAL = 400,
|
||||
MINUS = 401,
|
||||
PLUS = 402,
|
||||
DIVIDE = 403,
|
||||
TIMES = 404,
|
||||
UMINUS = 405,
|
||||
POWER = 406,
|
||||
EXP = 407,
|
||||
LOG = 408,
|
||||
LOG10 = 409,
|
||||
SIN = 410,
|
||||
COS = 411,
|
||||
TAN = 412,
|
||||
ASIN = 413,
|
||||
ACOS = 414,
|
||||
ATAN = 415,
|
||||
SINH = 416,
|
||||
COSH = 417,
|
||||
TANH = 418,
|
||||
ASINH = 419,
|
||||
ACOSH = 420,
|
||||
ATANH = 421,
|
||||
SQRT = 422,
|
||||
DYNARE_SENSITIVITY = 423,
|
||||
IDENTIFICATION = 424,
|
||||
MORRIS = 425,
|
||||
STAB = 426,
|
||||
REDFORM = 427,
|
||||
PPRIOR = 428,
|
||||
PRIOR_RANGE = 429,
|
||||
PPOST = 430,
|
||||
ILPTAU = 431,
|
||||
GLUE = 432,
|
||||
MORRIS_NLIV = 433,
|
||||
MORRIS_NTRA = 434,
|
||||
NSAM = 435,
|
||||
LOAD_REDFORM = 436,
|
||||
LOAD_RMSE = 437,
|
||||
LOAD_STAB = 438,
|
||||
ALPHA2_STAB = 439,
|
||||
KSSTAT = 440,
|
||||
LOGTRANS_REDFORM = 441,
|
||||
THRESHOLD_REDFORM = 442,
|
||||
KSSTAT_REDFORM = 443,
|
||||
ALPHA2_REDFORM = 444,
|
||||
NAMENDO = 445,
|
||||
NAMLAGENDO = 446,
|
||||
NAMEXO = 447,
|
||||
RMSE = 448,
|
||||
LIK_ONLY = 449,
|
||||
VAR_RMSE = 450,
|
||||
PFILT_RMSE = 451,
|
||||
ISTART_RMSE = 452,
|
||||
ALPHA_RMSE = 453,
|
||||
ALPHA2_RMSE = 454
|
||||
DYNASAVE = 284,
|
||||
DYNATYPE = 285,
|
||||
END = 286,
|
||||
ENDVAL = 287,
|
||||
EQUAL = 288,
|
||||
ESTIMATION = 289,
|
||||
ESTIMATED_PARAMS = 290,
|
||||
ESTIMATED_PARAMS_BOUNDS = 291,
|
||||
ESTIMATED_PARAMS_INIT = 292,
|
||||
FILENAME = 293,
|
||||
FILTER_STEP_AHEAD = 294,
|
||||
FILTERED_VARS = 295,
|
||||
FIRST_OBS = 296,
|
||||
FLOAT_NUMBER = 297,
|
||||
FORECAST = 298,
|
||||
GAMMA_PDF = 299,
|
||||
GCC_COMPILER = 300,
|
||||
GRAPH = 301,
|
||||
HISTVAL = 302,
|
||||
HP_FILTER = 303,
|
||||
HP_NGRID = 304,
|
||||
INITVAL = 305,
|
||||
INT_NUMBER = 306,
|
||||
INV_GAMMA_PDF = 307,
|
||||
IRF = 308,
|
||||
KALMAN_ALGO = 309,
|
||||
KALMAN_TOL = 310,
|
||||
LAPLACE = 311,
|
||||
LCC_COMPILER = 312,
|
||||
LIK_ALGO = 313,
|
||||
LIK_INIT = 314,
|
||||
LINEAR = 315,
|
||||
LOAD_MH_FILE = 316,
|
||||
LOGLINEAR = 317,
|
||||
MARKOWITZ = 318,
|
||||
MAX = 319,
|
||||
MH_DROP = 320,
|
||||
MH_INIT_SCALE = 321,
|
||||
MH_JSCALE = 322,
|
||||
MH_MODE = 323,
|
||||
MH_NBLOCKS = 324,
|
||||
MH_REPLIC = 325,
|
||||
MH_RECOVER = 326,
|
||||
MIN = 327,
|
||||
MODE_CHECK = 328,
|
||||
MODE_COMPUTE = 329,
|
||||
MODE_FILE = 330,
|
||||
MODEL = 331,
|
||||
MODEL_COMPARISON = 332,
|
||||
MSHOCKS = 333,
|
||||
MODEL_COMPARISON_APPROXIMATION = 334,
|
||||
MODIFIEDHARMONICMEAN = 335,
|
||||
MOMENTS_VARENDO = 336,
|
||||
NAME = 337,
|
||||
NO_COMPILER = 338,
|
||||
NOBS = 339,
|
||||
NOCONSTANT = 340,
|
||||
NOCORR = 341,
|
||||
NODIAGNOSTIC = 342,
|
||||
NOFUNCTIONS = 343,
|
||||
NOGRAPH = 344,
|
||||
NOMOMENTS = 345,
|
||||
NOPRINT = 346,
|
||||
NORMAL_PDF = 347,
|
||||
OBSERVATION_TRENDS = 348,
|
||||
OPTIM = 349,
|
||||
OPTIM_WEIGHTS = 350,
|
||||
ORDER = 351,
|
||||
OSR = 352,
|
||||
OSR_PARAMS = 353,
|
||||
PARAMETERS = 354,
|
||||
PERIODS = 355,
|
||||
PLANNER_OBJECTIVE = 356,
|
||||
PREFILTER = 357,
|
||||
PRESAMPLE = 358,
|
||||
PRINT = 359,
|
||||
PRIOR_TRUNC = 360,
|
||||
PRIOR_ANALYSIS = 361,
|
||||
POSTERIOR_ANALYSIS = 362,
|
||||
QZ_CRITERIUM = 363,
|
||||
RELATIVE_IRF = 364,
|
||||
REPLIC = 365,
|
||||
RPLOT = 366,
|
||||
SHOCKS = 367,
|
||||
SIGMA_E = 368,
|
||||
SIMUL = 369,
|
||||
SIMUL_ALGO = 370,
|
||||
SIMUL_SEED = 371,
|
||||
SMOOTHER = 372,
|
||||
SOLVE_ALGO = 373,
|
||||
SPARSE_DLL = 374,
|
||||
STDERR = 375,
|
||||
STEADY = 376,
|
||||
STOCH_SIMUL = 377,
|
||||
TEX = 378,
|
||||
RAMSEY_POLICY = 379,
|
||||
PLANNER_DISCOUNT = 380,
|
||||
TEX_NAME = 381,
|
||||
UNIFORM_PDF = 382,
|
||||
UNIT_ROOT_VARS = 383,
|
||||
USE_DLL = 384,
|
||||
VALUES = 385,
|
||||
VAR = 386,
|
||||
VAREXO = 387,
|
||||
VAREXO_DET = 388,
|
||||
VAROBS = 389,
|
||||
XLS_SHEET = 390,
|
||||
XLS_RANGE = 391,
|
||||
EXCLAMATION_EQUAL = 392,
|
||||
EXCLAMATION = 393,
|
||||
EQUAL_EQUAL = 394,
|
||||
GREATER_EQUAL = 395,
|
||||
LESS_EQUAL = 396,
|
||||
GREATER = 397,
|
||||
LESS = 398,
|
||||
COMMA = 399,
|
||||
MINUS = 400,
|
||||
PLUS = 401,
|
||||
DIVIDE = 402,
|
||||
TIMES = 403,
|
||||
UMINUS = 404,
|
||||
POWER = 405,
|
||||
EXP = 406,
|
||||
LOG = 407,
|
||||
LOG10 = 408,
|
||||
SIN = 409,
|
||||
COS = 410,
|
||||
TAN = 411,
|
||||
ASIN = 412,
|
||||
ACOS = 413,
|
||||
ATAN = 414,
|
||||
SINH = 415,
|
||||
COSH = 416,
|
||||
TANH = 417,
|
||||
ASINH = 418,
|
||||
ACOSH = 419,
|
||||
ATANH = 420,
|
||||
SQRT = 421,
|
||||
DYNARE_SENSITIVITY = 422,
|
||||
IDENTIFICATION = 423,
|
||||
MORRIS = 424,
|
||||
STAB = 425,
|
||||
REDFORM = 426,
|
||||
PPRIOR = 427,
|
||||
PRIOR_RANGE = 428,
|
||||
PPOST = 429,
|
||||
ILPTAU = 430,
|
||||
GLUE = 431,
|
||||
MORRIS_NLIV = 432,
|
||||
MORRIS_NTRA = 433,
|
||||
NSAM = 434,
|
||||
LOAD_REDFORM = 435,
|
||||
LOAD_RMSE = 436,
|
||||
LOAD_STAB = 437,
|
||||
ALPHA2_STAB = 438,
|
||||
KSSTAT = 439,
|
||||
LOGTRANS_REDFORM = 440,
|
||||
THRESHOLD_REDFORM = 441,
|
||||
KSSTAT_REDFORM = 442,
|
||||
ALPHA2_REDFORM = 443,
|
||||
NAMENDO = 444,
|
||||
NAMLAGENDO = 445,
|
||||
NAMEXO = 446,
|
||||
RMSE = 447,
|
||||
LIK_ONLY = 448,
|
||||
VAR_RMSE = 449,
|
||||
PFILT_RMSE = 450,
|
||||
ISTART_RMSE = 451,
|
||||
ALPHA_RMSE = 452,
|
||||
ALPHA2_RMSE = 453
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
@ -207,8 +207,7 @@ enum UnaryOpcode
|
|||
oAcosh,
|
||||
oAsinh,
|
||||
oAtanh,
|
||||
oSqrt,
|
||||
oDummy
|
||||
oSqrt
|
||||
};
|
||||
|
||||
//! Unary operator node
|
||||
|
|
|
@ -370,8 +370,6 @@ public:
|
|||
NodeID add_max(NodeID arg1, NodeID arg2);
|
||||
//! Writes token "min(arg1,arg2)" to model tree
|
||||
NodeID add_min(NodeID arg1, NodeID arg2);
|
||||
//! Writes token "dummy(arg1)" to model tree
|
||||
NodeID add_dummy(NodeID arg1);
|
||||
//! Adds an unknwon function argument
|
||||
void add_unknown_function_arg(NodeID arg);
|
||||
//! Adds an unknown function call node
|
||||
|
|
|
@ -6,7 +6,7 @@ LinBCG::LinBCG()
|
|||
|
||||
void LinBCG::Init(int periods, int y_kmin, int y_kmax, int Size, std::map<std::pair<std::pair<int, int> ,int>, int> IM_i, int* index_vara, int* index_equa)
|
||||
{
|
||||
std::map<std::pair<std::pair<int, int> ,int>, int>::iterator it4;
|
||||
std::map<std::pair<std::pair<int, int> ,int>, int>::iterator it3, it4;
|
||||
int Non_Zero_By_Lag[y_kmax+y_kmin+1];
|
||||
memset(Non_Zero_By_Lag, 0, sizeof(int)*(y_kmax+y_kmin+1));
|
||||
int i, j, k, nz_diag_count, eq, eqp, eq_count, var, lag, pos_u;
|
||||
|
@ -22,7 +22,9 @@ void LinBCG::Init(int periods, int y_kmin, int y_kmax, int Size, std::map<std::p
|
|||
lag=it4->first.second;
|
||||
pos_u=it4->second;
|
||||
if(var<Size*periods+y_kmax+y_kmin)
|
||||
{
|
||||
IM[make_pair(make_pair(eq, var), lag)]= pos_u;
|
||||
}
|
||||
it4++;
|
||||
}
|
||||
|
||||
|
@ -81,18 +83,34 @@ void LinBCG::Init(int periods, int y_kmin, int y_kmax, int Size, std::map<std::p
|
|||
cumulate_past_block=(int*)mxMalloc((periods+1)*sizeof(int));
|
||||
memset(cumulate_past_block, 0, sizeof(int)*(periods+1)*Size);
|
||||
mexPrintf("OK-1\n");
|
||||
cumulate_past_block[0]=0;
|
||||
for(j=1;j<=periods;j++)
|
||||
//cumulate_past_block[0]=0;
|
||||
it4=IM.begin();
|
||||
i=0;
|
||||
/*while(it4!=IM.end())
|
||||
{
|
||||
for(i=-y_kmin;i<=y_kmax;i++)
|
||||
int length=0;
|
||||
eq= it4->first.first.first;
|
||||
// Assumption no Row is completly null
|
||||
//if(eq!=eqp)
|
||||
j=inv_index_equa[index_equa[eq]];
|
||||
var=it4->first.first.second;
|
||||
lag=it4->first.second;
|
||||
for(j=-y_kmin;j<=y_kmax;j++)
|
||||
{
|
||||
if(j+i>0 && j+i<periods)
|
||||
it3=IM.begin();
|
||||
if(lag>j)
|
||||
while(it3!=IM.end())
|
||||
if(lag>j)
|
||||
length+=
|
||||
if(j+lag>0 && j+lag<=periods)
|
||||
cumulate_past_block[i+j*Size]+=length;
|
||||
else
|
||||
{
|
||||
mexPrintf("cumulate_past_block[%d]+=Non_Zero_By_Lag[%d]\n",j,i+y_kmin);
|
||||
cumulate_past_block[j]+=Non_Zero_By_Lag[i+y_kmin];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
i++;
|
||||
}*/
|
||||
for(j=0;j<=periods;j++)
|
||||
mexPrintf("cumulate_past_block[%d]=%d\n",j,cumulate_past_block[j]);
|
||||
int IM_Size=IM.size();
|
||||
|
|
|
@ -3761,6 +3761,42 @@ Interpreter::compute_block_time() /*throw(EvalException)*/
|
|||
Stack.push(v1 / v2);
|
||||
#ifdef DEBUGC
|
||||
mexPrintf("/\n");
|
||||
#endif
|
||||
break;
|
||||
case oLess:
|
||||
Stack.push(double(v1<v2));
|
||||
#ifdef DEBUGC
|
||||
mexPrintf("%f < %f\n",v1,v2);
|
||||
#endif
|
||||
break;
|
||||
case oGreater:
|
||||
Stack.push(double(v1>v2));
|
||||
#ifdef DEBUGC
|
||||
mexPrintf("%f > %f\n",v1,v2);
|
||||
#endif
|
||||
break;
|
||||
case oLessEqual:
|
||||
Stack.push(double(v1<=v2));
|
||||
#ifdef DEBUGC
|
||||
mexPrintf("%f <= %f\n",v1,v2);
|
||||
#endif
|
||||
break;
|
||||
case oGreaterEqual:
|
||||
Stack.push(double(v1>=v2));
|
||||
#ifdef DEBUGC
|
||||
mexPrintf("%f >= %f\n",v1,v2);
|
||||
#endif
|
||||
break;
|
||||
case oEqualEqual:
|
||||
Stack.push(double(v1==v2));
|
||||
#ifdef DEBUGC
|
||||
mexPrintf("%f == %f\n",v1,v2);
|
||||
#endif
|
||||
break;
|
||||
case oDifferent:
|
||||
Stack.push(double(v1!=v2));
|
||||
#ifdef DEBUGC
|
||||
mexPrintf("%f > %f\n",v1,v2);
|
||||
#endif
|
||||
break;
|
||||
case oPower:
|
||||
|
@ -3896,12 +3932,6 @@ Interpreter::compute_block_time() /*throw(EvalException)*/
|
|||
Stack.push(sqrt(v1));
|
||||
#ifdef DEBUGC
|
||||
mexPrintf("sqrt\n");
|
||||
#endif
|
||||
break;
|
||||
case oDummy:
|
||||
Stack.push(double (v1>0));
|
||||
#ifdef DEBUGC
|
||||
mexPrintf("dummy\n");
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
|
@ -4499,7 +4529,7 @@ Interpreter::compute_blocks(string file_name, string bin_basename)
|
|||
//mexPrintf("Block_Contain[%d].Own_Derivative=%d\n",i,lBlock_Contain.Own_Derivative);
|
||||
Block_Contain.push_back(lBlock_Contain);
|
||||
}
|
||||
simulate_a_block(lBlock.size,lBlock.type, file_name, bin_basename,/*false*/true);
|
||||
simulate_a_block(lBlock.size,lBlock.type, file_name, bin_basename,false/*true*/);
|
||||
break;
|
||||
case FEND :
|
||||
//mexPrintf("FEND\n");
|
||||
|
|
Loading…
Reference in New Issue