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-bf33cf982152
time-shift
ferhat 2007-10-15 09:04:08 +00:00
parent 020035a81b
commit a5323768aa
12 changed files with 2332 additions and 2373 deletions

View File

@ -367,12 +367,6 @@ DataTree::AddMin(NodeID iArg1, NodeID iArg2)
return AddBinaryOp(iArg1, oMin, iArg2); return AddBinaryOp(iArg1, oMin, iArg2);
} }
NodeID
DataTree::AddDuMmY(NodeID iArg1)
{
return AddUnaryOp(oDummy,iArg1);
}
NodeID NodeID
DataTree::AddEqual(NodeID iArg1, NodeID iArg2) DataTree::AddEqual(NodeID iArg1, NodeID iArg2)
{ {

File diff suppressed because it is too large Load Diff

View File

@ -40,7 +40,7 @@ class ParsingDriver;
%token BVAR_PRIOR_MU BVAR_PRIOR_OMEGA BVAR_PRIOR_TAU BVAR_PRIOR_TRAIN %token BVAR_PRIOR_MU BVAR_PRIOR_OMEGA BVAR_PRIOR_TAU BVAR_PRIOR_TRAIN
%token BVAR_REPLIC %token BVAR_REPLIC
%token CALIB CALIB_VAR CHECK CONF_SIG CONSTANT CORR COVAR CUTOFF %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 END ENDVAL EQUAL ESTIMATION ESTIMATED_PARAMS ESTIMATED_PARAMS_BOUNDS ESTIMATED_PARAMS_INIT
%token FILENAME FILTER_STEP_AHEAD FILTERED_VARS FIRST_OBS %token FILENAME FILTER_STEP_AHEAD FILTERED_VARS FIRST_OBS
%token <string_val> FLOAT_NUMBER %token <string_val> FLOAT_NUMBER
@ -294,8 +294,6 @@ expression : '(' expression ')'
{ $$ = driver.add_atan($3); } { $$ = driver.add_atan($3); }
| SQRT '(' expression ')' | SQRT '(' expression ')'
{ $$ = driver.add_sqrt($3); } { $$ = driver.add_sqrt($3); }
| DUMMY '(' expression ')'
{ $$ = driver.add_dummy($3); }
| MAX '(' expression COMMA expression ')' | MAX '(' expression COMMA expression ')'
{ $$ = driver.add_max($3 , $5); } { $$ = driver.add_max($3 , $5); }
| MIN '(' expression COMMA expression ')' | MIN '(' expression COMMA expression ')'
@ -426,8 +424,6 @@ hand_side : '(' hand_side ')'
{ $$ = driver.add_atan($3); } { $$ = driver.add_atan($3); }
| SQRT '(' hand_side ')' | SQRT '(' hand_side ')'
{ $$ = driver.add_sqrt($3); } { $$ = driver.add_sqrt($3); }
| DUMMY '(' hand_side ')'
{ $$ = driver.add_dummy($3); }
| MAX '(' hand_side COMMA hand_side ')' | MAX '(' hand_side COMMA hand_side ')'
{ $$ = driver.add_max($3 , $5); } { $$ = driver.add_max($3 , $5); }
| MIN '(' hand_side COMMA hand_side ')' | MIN '(' hand_side COMMA hand_side ')'

View File

@ -270,7 +270,6 @@ int sigma_e = 0;
<DYNARE_STATEMENT,DYNARE_BLOCK>sqrt {return token::SQRT;} <DYNARE_STATEMENT,DYNARE_BLOCK>sqrt {return token::SQRT;}
<DYNARE_STATEMENT,DYNARE_BLOCK>max {return token::MAX;} <DYNARE_STATEMENT,DYNARE_BLOCK>max {return token::MAX;}
<DYNARE_STATEMENT,DYNARE_BLOCK>min {return token::MIN;} <DYNARE_STATEMENT,DYNARE_BLOCK>min {return token::MIN;}
<DYNARE_STATEMENT,DYNARE_BLOCK>dummy {return token::DUMMY;}
/* options for GSA module by Marco Ratto */ /* options for GSA module by Marco Ratto */
<DYNARE_STATEMENT>identification {return token::IDENTIFICATION;} <DYNARE_STATEMENT>identification {return token::IDENTIFICATION;}

View File

@ -521,8 +521,6 @@ UnaryOpNode::computeDerivative(int varID)
case oSqrt: case oSqrt:
t11 = datatree.AddPlus(this, this); t11 = datatree.AddPlus(this, this);
return datatree.AddDivide(darg, t11); return datatree.AddDivide(darg, t11);
case oDummy:
return datatree.Zero;
} }
cerr << "Impossible case!" << endl; cerr << "Impossible case!" << endl;
exit(-1); exit(-1);
@ -574,8 +572,6 @@ UnaryOpNode::cost(const temporary_terms_type &temporary_terms, bool is_matlab) c
return cost + 350; return cost + 350;
case oSqrt: case oSqrt:
return cost + 570; return cost + 570;
case oDummy:
return cost + 200;
} }
else else
// Cost for C files // Cost for C files
@ -610,8 +606,6 @@ UnaryOpNode::cost(const temporary_terms_type &temporary_terms, bool is_matlab) c
return cost + 150; return cost + 150;
case oSqrt: case oSqrt:
return cost + 90; return cost + 90;
case oDummy:
return cost + 50;
} }
cerr << "Impossible case!" << endl; cerr << "Impossible case!" << endl;
exit(-1); exit(-1);
@ -680,16 +674,6 @@ UnaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
return; 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 // Always put parenthesis around uminus nodes
if (op_code == oUminus) if (op_code == oUminus)
output << "("; output << "(";
@ -816,8 +800,6 @@ UnaryOpNode::eval_opcode(UnaryOpcode op_code, double v) throw (EvalException)
return(atanh(v)); return(atanh(v));
case oSqrt: case oSqrt:
return(sqrt(v)); return(sqrt(v));
case oDummy:
return(double (v>0));
} }
// Impossible // Impossible
throw EvalException(); throw EvalException();
@ -928,21 +910,19 @@ BinaryOpNode::computeDerivative(int varID)
return datatree.AddTimes(t15, this); return datatree.AddTimes(t15, this);
} }
case oMax: case oMax:
t11 = datatree.AddMinus(arg1,arg2); t11 = datatree.AddGreater(arg1,arg2);
t12 = datatree.AddDuMmY(t11); t12 = datatree.AddTimes(t11,darg1);
t13 = datatree.AddTimes(t12,darg1); t13 = datatree.AddMinus(datatree.One,t11);
t14 = datatree.AddMinus(datatree.One,t12); t14 = datatree.AddTimes(t13,darg2);
t15 = datatree.AddTimes(t14,darg2); return datatree.AddPlus(t14,t12);
return datatree.AddPlus(t15,t13);
case oMin: case oMin:
t11 = datatree.AddMinus(arg2,arg1); t11 = datatree.AddGreater(arg2,arg1);
t12 = datatree.AddDuMmY(t11); t12 = datatree.AddTimes(t11,darg1);
t13 = datatree.AddTimes(t12,darg1); t13 = datatree.AddMinus(datatree.One,t11);
t14 = datatree.AddMinus(datatree.One,t12); t14 = datatree.AddTimes(t13,darg2);
t15 = datatree.AddTimes(t14,darg2); return datatree.AddPlus(t14,t12);
return datatree.AddPlus(t15,t13);
case oEqual: case oEqual:
return datatree.AddMinus(darg1, darg2); return datatree.AddMinus(darg1, darg2);
} }
cerr << "Impossible case!" << endl; cerr << "Impossible case!" << endl;
exit(-1); exit(-1);
@ -977,7 +957,7 @@ BinaryOpNode::precedence(ExprNodeOutputType output_type, const temporary_terms_t
// In C, power operator is of the form pow(a, b) // In C, power operator is of the form pow(a, b)
return 100; return 100;
else else
return 4; return 4;
} }
cerr << "Impossible case!" << endl; cerr << "Impossible case!" << endl;
exit(-1); exit(-1);
@ -1264,7 +1244,10 @@ BinaryOpNode::writeOutput(ostream &output, ExprNodeOutputType output_type,
output << "=="; output << "==";
break; break;
case oDifferent: case oDifferent:
output << "!="; if(OFFSET(output_type))
output << "~=";
else
output << "!=";
break; break;
case oEqual: case oEqual:
output << "="; output << "=";

View File

@ -1200,12 +1200,6 @@ ParsingDriver::add_min(NodeID arg1, NodeID arg2)
return data_tree->AddMin(arg1,arg2); return data_tree->AddMin(arg1,arg2);
} }
NodeID
ParsingDriver::add_dummy(NodeID arg1)
{
return data_tree->AddDuMmY(arg1);
}
void void
ParsingDriver::add_unknown_function_arg(NodeID arg) ParsingDriver::add_unknown_function_arg(NodeID arg)
{ {

View File

@ -125,8 +125,6 @@ public:
NodeID AddMaX(NodeID iArg1, NodeID iArg2); NodeID AddMaX(NodeID iArg1, NodeID iArg2);
//! Adds "min(arg1,arg2)" to model tree //! Adds "min(arg1,arg2)" to model tree
NodeID AddMin(NodeID iArg1, NodeID iArg2); NodeID AddMin(NodeID iArg1, NodeID iArg2);
//! Adds "dummy(arg1)" to model tree
NodeID AddDuMmY(NodeID iArg1);
//! Adds "arg1=arg2" to model tree //! Adds "arg1=arg2" to model tree
NodeID AddEqual(NodeID iArg1, NodeID iArg2); NodeID AddEqual(NodeID iArg1, NodeID iArg2);
void AddLocalParameter(const string &name, NodeID value) throw (LocalParameterException); void AddLocalParameter(const string &name, NodeID value) throw (LocalParameterException);

View File

@ -153,177 +153,176 @@ namespace yy
DR_ALGO = 281, DR_ALGO = 281,
DROP = 282, DROP = 282,
DSAMPLE = 283, DSAMPLE = 283,
DUMMY = 284, DYNASAVE = 284,
DYNASAVE = 285, DYNATYPE = 285,
DYNATYPE = 286, END = 286,
END = 287, ENDVAL = 287,
ENDVAL = 288, EQUAL = 288,
EQUAL = 289, ESTIMATION = 289,
ESTIMATION = 290, ESTIMATED_PARAMS = 290,
ESTIMATED_PARAMS = 291, ESTIMATED_PARAMS_BOUNDS = 291,
ESTIMATED_PARAMS_BOUNDS = 292, ESTIMATED_PARAMS_INIT = 292,
ESTIMATED_PARAMS_INIT = 293, FILENAME = 293,
FILENAME = 294, FILTER_STEP_AHEAD = 294,
FILTER_STEP_AHEAD = 295, FILTERED_VARS = 295,
FILTERED_VARS = 296, FIRST_OBS = 296,
FIRST_OBS = 297, FLOAT_NUMBER = 297,
FLOAT_NUMBER = 298, FORECAST = 298,
FORECAST = 299, GAMMA_PDF = 299,
GAMMA_PDF = 300, GCC_COMPILER = 300,
GCC_COMPILER = 301, GRAPH = 301,
GRAPH = 302, HISTVAL = 302,
HISTVAL = 303, HP_FILTER = 303,
HP_FILTER = 304, HP_NGRID = 304,
HP_NGRID = 305, INITVAL = 305,
INITVAL = 306, INT_NUMBER = 306,
INT_NUMBER = 307, INV_GAMMA_PDF = 307,
INV_GAMMA_PDF = 308, IRF = 308,
IRF = 309, KALMAN_ALGO = 309,
KALMAN_ALGO = 310, KALMAN_TOL = 310,
KALMAN_TOL = 311, LAPLACE = 311,
LAPLACE = 312, LCC_COMPILER = 312,
LCC_COMPILER = 313, LIK_ALGO = 313,
LIK_ALGO = 314, LIK_INIT = 314,
LIK_INIT = 315, LINEAR = 315,
LINEAR = 316, LOAD_MH_FILE = 316,
LOAD_MH_FILE = 317, LOGLINEAR = 317,
LOGLINEAR = 318, MARKOWITZ = 318,
MARKOWITZ = 319, MAX = 319,
MAX = 320, MH_DROP = 320,
MH_DROP = 321, MH_INIT_SCALE = 321,
MH_INIT_SCALE = 322, MH_JSCALE = 322,
MH_JSCALE = 323, MH_MODE = 323,
MH_MODE = 324, MH_NBLOCKS = 324,
MH_NBLOCKS = 325, MH_REPLIC = 325,
MH_REPLIC = 326, MH_RECOVER = 326,
MH_RECOVER = 327, MIN = 327,
MIN = 328, MODE_CHECK = 328,
MODE_CHECK = 329, MODE_COMPUTE = 329,
MODE_COMPUTE = 330, MODE_FILE = 330,
MODE_FILE = 331, MODEL = 331,
MODEL = 332, MODEL_COMPARISON = 332,
MODEL_COMPARISON = 333, MSHOCKS = 333,
MSHOCKS = 334, MODEL_COMPARISON_APPROXIMATION = 334,
MODEL_COMPARISON_APPROXIMATION = 335, MODIFIEDHARMONICMEAN = 335,
MODIFIEDHARMONICMEAN = 336, MOMENTS_VARENDO = 336,
MOMENTS_VARENDO = 337, NAME = 337,
NAME = 338, NO_COMPILER = 338,
NO_COMPILER = 339, NOBS = 339,
NOBS = 340, NOCONSTANT = 340,
NOCONSTANT = 341, NOCORR = 341,
NOCORR = 342, NODIAGNOSTIC = 342,
NODIAGNOSTIC = 343, NOFUNCTIONS = 343,
NOFUNCTIONS = 344, NOGRAPH = 344,
NOGRAPH = 345, NOMOMENTS = 345,
NOMOMENTS = 346, NOPRINT = 346,
NOPRINT = 347, NORMAL_PDF = 347,
NORMAL_PDF = 348, OBSERVATION_TRENDS = 348,
OBSERVATION_TRENDS = 349, OPTIM = 349,
OPTIM = 350, OPTIM_WEIGHTS = 350,
OPTIM_WEIGHTS = 351, ORDER = 351,
ORDER = 352, OSR = 352,
OSR = 353, OSR_PARAMS = 353,
OSR_PARAMS = 354, PARAMETERS = 354,
PARAMETERS = 355, PERIODS = 355,
PERIODS = 356, PLANNER_OBJECTIVE = 356,
PLANNER_OBJECTIVE = 357, PREFILTER = 357,
PREFILTER = 358, PRESAMPLE = 358,
PRESAMPLE = 359, PRINT = 359,
PRINT = 360, PRIOR_TRUNC = 360,
PRIOR_TRUNC = 361, PRIOR_ANALYSIS = 361,
PRIOR_ANALYSIS = 362, POSTERIOR_ANALYSIS = 362,
POSTERIOR_ANALYSIS = 363, QZ_CRITERIUM = 363,
QZ_CRITERIUM = 364, RELATIVE_IRF = 364,
RELATIVE_IRF = 365, REPLIC = 365,
REPLIC = 366, RPLOT = 366,
RPLOT = 367, SHOCKS = 367,
SHOCKS = 368, SIGMA_E = 368,
SIGMA_E = 369, SIMUL = 369,
SIMUL = 370, SIMUL_ALGO = 370,
SIMUL_ALGO = 371, SIMUL_SEED = 371,
SIMUL_SEED = 372, SMOOTHER = 372,
SMOOTHER = 373, SOLVE_ALGO = 373,
SOLVE_ALGO = 374, SPARSE_DLL = 374,
SPARSE_DLL = 375, STDERR = 375,
STDERR = 376, STEADY = 376,
STEADY = 377, STOCH_SIMUL = 377,
STOCH_SIMUL = 378, TEX = 378,
TEX = 379, RAMSEY_POLICY = 379,
RAMSEY_POLICY = 380, PLANNER_DISCOUNT = 380,
PLANNER_DISCOUNT = 381, TEX_NAME = 381,
TEX_NAME = 382, UNIFORM_PDF = 382,
UNIFORM_PDF = 383, UNIT_ROOT_VARS = 383,
UNIT_ROOT_VARS = 384, USE_DLL = 384,
USE_DLL = 385, VALUES = 385,
VALUES = 386, VAR = 386,
VAR = 387, VAREXO = 387,
VAREXO = 388, VAREXO_DET = 388,
VAREXO_DET = 389, VAROBS = 389,
VAROBS = 390, XLS_SHEET = 390,
XLS_SHEET = 391, XLS_RANGE = 391,
XLS_RANGE = 392, EXCLAMATION_EQUAL = 392,
COMMA = 393, EXCLAMATION = 393,
GREATER = 394, EQUAL_EQUAL = 394,
LESS = 395, GREATER_EQUAL = 395,
EXCLAMATION_EQUAL = 396, LESS_EQUAL = 396,
EXCLAMATION = 397, GREATER = 397,
EQUAL_EQUAL = 398, LESS = 398,
GREATER_EQUAL = 399, COMMA = 399,
LESS_EQUAL = 400, MINUS = 400,
MINUS = 401, PLUS = 401,
PLUS = 402, DIVIDE = 402,
DIVIDE = 403, TIMES = 403,
TIMES = 404, UMINUS = 404,
UMINUS = 405, POWER = 405,
POWER = 406, EXP = 406,
EXP = 407, LOG = 407,
LOG = 408, LOG10 = 408,
LOG10 = 409, SIN = 409,
SIN = 410, COS = 410,
COS = 411, TAN = 411,
TAN = 412, ASIN = 412,
ASIN = 413, ACOS = 413,
ACOS = 414, ATAN = 414,
ATAN = 415, SINH = 415,
SINH = 416, COSH = 416,
COSH = 417, TANH = 417,
TANH = 418, ASINH = 418,
ASINH = 419, ACOSH = 419,
ACOSH = 420, ATANH = 420,
ATANH = 421, SQRT = 421,
SQRT = 422, DYNARE_SENSITIVITY = 422,
DYNARE_SENSITIVITY = 423, IDENTIFICATION = 423,
IDENTIFICATION = 424, MORRIS = 424,
MORRIS = 425, STAB = 425,
STAB = 426, REDFORM = 426,
REDFORM = 427, PPRIOR = 427,
PPRIOR = 428, PRIOR_RANGE = 428,
PRIOR_RANGE = 429, PPOST = 429,
PPOST = 430, ILPTAU = 430,
ILPTAU = 431, GLUE = 431,
GLUE = 432, MORRIS_NLIV = 432,
MORRIS_NLIV = 433, MORRIS_NTRA = 433,
MORRIS_NTRA = 434, NSAM = 434,
NSAM = 435, LOAD_REDFORM = 435,
LOAD_REDFORM = 436, LOAD_RMSE = 436,
LOAD_RMSE = 437, LOAD_STAB = 437,
LOAD_STAB = 438, ALPHA2_STAB = 438,
ALPHA2_STAB = 439, KSSTAT = 439,
KSSTAT = 440, LOGTRANS_REDFORM = 440,
LOGTRANS_REDFORM = 441, THRESHOLD_REDFORM = 441,
THRESHOLD_REDFORM = 442, KSSTAT_REDFORM = 442,
KSSTAT_REDFORM = 443, ALPHA2_REDFORM = 443,
ALPHA2_REDFORM = 444, NAMENDO = 444,
NAMENDO = 445, NAMLAGENDO = 445,
NAMLAGENDO = 446, NAMEXO = 446,
NAMEXO = 447, RMSE = 447,
RMSE = 448, LIK_ONLY = 448,
LIK_ONLY = 449, VAR_RMSE = 449,
VAR_RMSE = 450, PFILT_RMSE = 450,
PFILT_RMSE = 451, ISTART_RMSE = 451,
ISTART_RMSE = 452, ALPHA_RMSE = 452,
ALPHA_RMSE = 453, ALPHA2_RMSE = 453
ALPHA2_RMSE = 454
}; };
}; };

View File

@ -207,8 +207,7 @@ enum UnaryOpcode
oAcosh, oAcosh,
oAsinh, oAsinh,
oAtanh, oAtanh,
oSqrt, oSqrt
oDummy
}; };
//! Unary operator node //! Unary operator node

View File

@ -370,8 +370,6 @@ public:
NodeID add_max(NodeID arg1, NodeID arg2); NodeID add_max(NodeID arg1, NodeID arg2);
//! Writes token "min(arg1,arg2)" to model tree //! Writes token "min(arg1,arg2)" to model tree
NodeID add_min(NodeID arg1, NodeID arg2); NodeID add_min(NodeID arg1, NodeID arg2);
//! Writes token "dummy(arg1)" to model tree
NodeID add_dummy(NodeID arg1);
//! Adds an unknwon function argument //! Adds an unknwon function argument
void add_unknown_function_arg(NodeID arg); void add_unknown_function_arg(NodeID arg);
//! Adds an unknown function call node //! Adds an unknown function call node

View File

@ -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) 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]; int Non_Zero_By_Lag[y_kmax+y_kmin+1];
memset(Non_Zero_By_Lag, 0, sizeof(int)*(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; 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; lag=it4->first.second;
pos_u=it4->second; pos_u=it4->second;
if(var<Size*periods+y_kmax+y_kmin) if(var<Size*periods+y_kmax+y_kmin)
IM[make_pair(make_pair(eq, var), lag)]= pos_u; {
IM[make_pair(make_pair(eq, var), lag)]= pos_u;
}
it4++; it4++;
} }
@ -47,7 +49,7 @@ void LinBCG::Init(int periods, int y_kmin, int y_kmax, int Size, std::map<std::p
j=inv_index_equa[index_equa[eq]]; j=inv_index_equa[index_equa[eq]];
var=it4->first.first.second; var=it4->first.first.second;
lag=it4->first.second; lag=it4->first.second;
mexPrintf("eq=%d var=%d lag=%d \n",eq, var, lag); mexPrintf("eq=%d var=%d lag=%d\n",eq, var, lag);
if(!lag) if(!lag)
{ {
if(var==index_vara[j] && eq==index_equa[j]) if(var==index_vara[j] && eq==index_equa[j])
@ -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)); cumulate_past_block=(int*)mxMalloc((periods+1)*sizeof(int));
memset(cumulate_past_block, 0, sizeof(int)*(periods+1)*Size); memset(cumulate_past_block, 0, sizeof(int)*(periods+1)*Size);
mexPrintf("OK-1\n"); mexPrintf("OK-1\n");
cumulate_past_block[0]=0; //cumulate_past_block[0]=0;
for(j=1;j<=periods;j++) 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++) for(j=0;j<=periods;j++)
mexPrintf("cumulate_past_block[%d]=%d\n",j,cumulate_past_block[j]); mexPrintf("cumulate_past_block[%d]=%d\n",j,cumulate_past_block[j]);
int IM_Size=IM.size(); int IM_Size=IM.size();

View File

@ -3761,6 +3761,42 @@ Interpreter::compute_block_time() /*throw(EvalException)*/
Stack.push(v1 / v2); Stack.push(v1 / v2);
#ifdef DEBUGC #ifdef DEBUGC
mexPrintf("/\n"); 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 #endif
break; break;
case oPower: case oPower:
@ -3896,12 +3932,6 @@ Interpreter::compute_block_time() /*throw(EvalException)*/
Stack.push(sqrt(v1)); Stack.push(sqrt(v1));
#ifdef DEBUGC #ifdef DEBUGC
mexPrintf("sqrt\n"); mexPrintf("sqrt\n");
#endif
break;
case oDummy:
Stack.push(double (v1>0));
#ifdef DEBUGC
mexPrintf("dummy\n");
#endif #endif
break; break;
default: 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); //mexPrintf("Block_Contain[%d].Own_Derivative=%d\n",i,lBlock_Contain.Own_Derivative);
Block_Contain.push_back(lBlock_Contain); 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; break;
case FEND : case FEND :
//mexPrintf("FEND\n"); //mexPrintf("FEND\n");