Cleaning the code: getting rid of unused variables
parent
ee9213d77c
commit
eb567f5202
|
@ -358,9 +358,6 @@ public:
|
|||
bool go_on = true;
|
||||
double ll;
|
||||
ExpressionType equation_type = TemporaryTerm;
|
||||
unsigned int equation_num;
|
||||
unsigned int dvar1, dvar2, dvar3;
|
||||
int lag1, lag2, lag3;
|
||||
size_t found;
|
||||
double *jacob = NULL, *jacob_other_endo = NULL, *jacob_exo = NULL, *jacob_exo_det = NULL;
|
||||
external_function_type function_type = ExternalFunctionWithoutDerivative;
|
||||
|
@ -385,107 +382,48 @@ public:
|
|||
{
|
||||
case TemporaryTerm:
|
||||
equation_type = TemporaryTerm;
|
||||
equation_num = ((FNUMEXPR_ *) it_code->second)->get_equation();
|
||||
break;
|
||||
case ModelEquation:
|
||||
equation_type = ModelEquation;
|
||||
equation_num = ((FNUMEXPR_ *) it_code->second)->get_equation();
|
||||
break;
|
||||
case FirstEndoDerivative:
|
||||
equation_type = FirstEndoDerivative;
|
||||
equation_num = ((FNUMEXPR_ *) it_code->second)->get_equation();
|
||||
dvar1 = ((FNUMEXPR_ *) it_code->second)->get_dvariable1();
|
||||
lag1 = ((FNUMEXPR_ *) it_code->second)->get_lag1();
|
||||
break;
|
||||
case FirstOtherEndoDerivative:
|
||||
equation_type = FirstOtherEndoDerivative;
|
||||
equation_num = ((FNUMEXPR_ *) it_code->second)->get_equation();
|
||||
dvar1 = ((FNUMEXPR_ *) it_code->second)->get_dvariable1();
|
||||
lag1 = ((FNUMEXPR_ *) it_code->second)->get_lag1();
|
||||
break;
|
||||
case FirstExoDerivative:
|
||||
equation_type = FirstExoDerivative;
|
||||
equation_num = ((FNUMEXPR_ *) it_code->second)->get_equation();
|
||||
dvar1 = ((FNUMEXPR_ *) it_code->second)->get_dvariable1();
|
||||
lag1 = ((FNUMEXPR_ *) it_code->second)->get_lag1();
|
||||
break;
|
||||
case FirstExodetDerivative:
|
||||
equation_type = FirstExodetDerivative;
|
||||
equation_num = ((FNUMEXPR_ *) it_code->second)->get_equation();
|
||||
dvar1 = ((FNUMEXPR_ *) it_code->second)->get_dvariable1();
|
||||
lag1 = ((FNUMEXPR_ *) it_code->second)->get_lag1();
|
||||
break;
|
||||
case FirstParamDerivative:
|
||||
equation_type = FirstParamDerivative;
|
||||
equation_num = ((FNUMEXPR_ *) it_code->second)->get_equation();
|
||||
dvar1 = ((FNUMEXPR_ *) it_code->second)->get_dvariable1();
|
||||
break;
|
||||
case SecondEndoDerivative:
|
||||
equation_type = SecondEndoDerivative;
|
||||
equation_num = ((FNUMEXPR_ *) it_code->second)->get_equation();
|
||||
dvar1 = ((FNUMEXPR_ *) it_code->second)->get_dvariable1();
|
||||
lag1 = ((FNUMEXPR_ *) it_code->second)->get_lag1();
|
||||
dvar2 = ((FNUMEXPR_ *) it_code->second)->get_dvariable2();
|
||||
lag2 = ((FNUMEXPR_ *) it_code->second)->get_lag2();
|
||||
break;
|
||||
case SecondExoDerivative:
|
||||
equation_type = SecondExoDerivative;
|
||||
equation_num = ((FNUMEXPR_ *) it_code->second)->get_equation();
|
||||
dvar1 = ((FNUMEXPR_ *) it_code->second)->get_dvariable1();
|
||||
lag1 = ((FNUMEXPR_ *) it_code->second)->get_lag1();
|
||||
dvar2 = ((FNUMEXPR_ *) it_code->second)->get_dvariable2();
|
||||
lag2 = ((FNUMEXPR_ *) it_code->second)->get_lag2();
|
||||
break;
|
||||
case SecondExodetDerivative:
|
||||
equation_type = SecondExodetDerivative;
|
||||
equation_num = ((FNUMEXPR_ *) it_code->second)->get_equation();
|
||||
dvar1 = ((FNUMEXPR_ *) it_code->second)->get_dvariable1();
|
||||
lag1 = ((FNUMEXPR_ *) it_code->second)->get_lag1();
|
||||
dvar2 = ((FNUMEXPR_ *) it_code->second)->get_dvariable2();
|
||||
lag2 = ((FNUMEXPR_ *) it_code->second)->get_lag2();
|
||||
break;
|
||||
case SecondParamDerivative:
|
||||
equation_type = SecondExodetDerivative;
|
||||
equation_num = ((FNUMEXPR_ *) it_code->second)->get_equation();
|
||||
dvar1 = ((FNUMEXPR_ *) it_code->second)->get_dvariable1();
|
||||
dvar2 = ((FNUMEXPR_ *) it_code->second)->get_dvariable2();
|
||||
break;
|
||||
case ThirdEndoDerivative:
|
||||
equation_type = ThirdEndoDerivative;
|
||||
equation_num = ((FNUMEXPR_ *) it_code->second)->get_equation();
|
||||
dvar1 = ((FNUMEXPR_ *) it_code->second)->get_dvariable1();
|
||||
lag1 = ((FNUMEXPR_ *) it_code->second)->get_lag1();
|
||||
dvar2 = ((FNUMEXPR_ *) it_code->second)->get_dvariable2();
|
||||
lag2 = ((FNUMEXPR_ *) it_code->second)->get_lag2();
|
||||
dvar3 = ((FNUMEXPR_ *) it_code->second)->get_dvariable2();
|
||||
lag3 = ((FNUMEXPR_ *) it_code->second)->get_lag3();
|
||||
break;
|
||||
case ThirdExoDerivative:
|
||||
equation_type = ThirdExoDerivative;
|
||||
equation_num = ((FNUMEXPR_ *) it_code->second)->get_equation();
|
||||
dvar1 = ((FNUMEXPR_ *) it_code->second)->get_dvariable1();
|
||||
lag1 = ((FNUMEXPR_ *) it_code->second)->get_lag1();
|
||||
dvar2 = ((FNUMEXPR_ *) it_code->second)->get_dvariable2();
|
||||
lag2 = ((FNUMEXPR_ *) it_code->second)->get_lag2();
|
||||
dvar3 = ((FNUMEXPR_ *) it_code->second)->get_dvariable2();
|
||||
lag3 = ((FNUMEXPR_ *) it_code->second)->get_lag3();
|
||||
break;
|
||||
case ThirdExodetDerivative:
|
||||
equation_type = ThirdExodetDerivative;
|
||||
equation_num = ((FNUMEXPR_ *) it_code->second)->get_equation();
|
||||
dvar1 = ((FNUMEXPR_ *) it_code->second)->get_dvariable1();
|
||||
lag1 = ((FNUMEXPR_ *) it_code->second)->get_lag1();
|
||||
dvar2 = ((FNUMEXPR_ *) it_code->second)->get_dvariable2();
|
||||
lag2 = ((FNUMEXPR_ *) it_code->second)->get_lag2();
|
||||
dvar3 = ((FNUMEXPR_ *) it_code->second)->get_dvariable2();
|
||||
lag3 = ((FNUMEXPR_ *) it_code->second)->get_lag3();
|
||||
break;
|
||||
case ThirdParamDerivative:
|
||||
equation_type = ThirdExodetDerivative;
|
||||
equation_num = ((FNUMEXPR_ *) it_code->second)->get_equation();
|
||||
dvar1 = ((FNUMEXPR_ *) it_code->second)->get_dvariable1();
|
||||
dvar2 = ((FNUMEXPR_ *) it_code->second)->get_dvariable2();
|
||||
dvar3 = ((FNUMEXPR_ *) it_code->second)->get_dvariable2();
|
||||
break;
|
||||
default:
|
||||
ostringstream tmp;
|
||||
|
|
|
@ -1725,7 +1725,6 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name,
|
|||
it_code_type begining;
|
||||
int i;
|
||||
bool cvg;
|
||||
int giter;
|
||||
bool result = true;
|
||||
double *y_save;
|
||||
res1 = 0;
|
||||
|
@ -2348,7 +2347,6 @@ Interpreter::simulate_a_block(const int size, const int type, string file_name,
|
|||
r = (double *) mxMalloc(size*sizeof(double));
|
||||
y_save = (double *) mxMalloc(y_size*sizeof(double)*(periods+y_kmax+y_kmin));
|
||||
begining = it_code;
|
||||
giter = 0;
|
||||
iter = 0;
|
||||
if (!is_linear)
|
||||
{
|
||||
|
|
|
@ -894,10 +894,8 @@ SparseMatrix::compare(int *save_op, int *save_opa, int *save_opaa, int beg_t, in
|
|||
long int i, j, nop = nop4/2, t, k;
|
||||
double r = 0.0;
|
||||
bool OK = true;
|
||||
clock_t t001;
|
||||
t_save_op_s *save_op_s, *save_opa_s, *save_opaa_s;
|
||||
int *diff1, *diff2;
|
||||
t001 = clock();
|
||||
diff1 = (int *) mxMalloc(nop*sizeof(int));
|
||||
diff2 = (int *) mxMalloc(nop*sizeof(int));
|
||||
int max_save_ops_first = -1;
|
||||
|
@ -1141,7 +1139,6 @@ SparseMatrix::complete(int beg_t, int Size, int periods, int *b)
|
|||
}
|
||||
max_var = (periods+y_kmin)*y_size;
|
||||
min_var = y_kmin*y_size;
|
||||
int k1 = 0;
|
||||
for (t = periods+y_kmin-1; t >= beg_t+y_kmin; t--)
|
||||
{
|
||||
j = 0;
|
||||
|
@ -1165,7 +1162,6 @@ SparseMatrix::complete(int beg_t, int Size, int periods, int *b)
|
|||
break;
|
||||
case IFSTP:
|
||||
k = save_code[i+1]+ti*diff[j];
|
||||
k1 = k;
|
||||
err = yy - y[k];
|
||||
y[k] += slowc*(err);
|
||||
break;
|
||||
|
@ -1178,7 +1174,7 @@ SparseMatrix::complete(int beg_t, int Size, int periods, int *b)
|
|||
return (beg_t);
|
||||
}
|
||||
|
||||
double
|
||||
void
|
||||
SparseMatrix::bksub(int tbreak, int last_period, int Size, double slowc_l)
|
||||
{
|
||||
NonZeroElem *first;
|
||||
|
@ -1214,10 +1210,9 @@ SparseMatrix::bksub(int tbreak, int last_period, int Size, double slowc_l)
|
|||
y[eq] += slowc_l*yy;
|
||||
}
|
||||
}
|
||||
return res1;
|
||||
}
|
||||
|
||||
double
|
||||
void
|
||||
SparseMatrix::simple_bksub(int it_, int Size, double slowc_l)
|
||||
{
|
||||
int i, k;
|
||||
|
@ -1242,7 +1237,6 @@ SparseMatrix::simple_bksub(int it_, int Size, double slowc_l)
|
|||
direction[eq+it_*y_size] = yy;
|
||||
y[eq+it_*y_size] += slowc_l*yy;
|
||||
}
|
||||
return res1;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1797,7 +1791,6 @@ SparseMatrix::Solve_Matlab_Relaxation(mxArray *A_m, mxArray *b_m, unsigned int S
|
|||
A3_j[++A3_var] = A3_nze;
|
||||
mxArray *d1 = NULL;
|
||||
vector<pair<mxArray *, mxArray *> > triangular_form;
|
||||
int last_t = 0;
|
||||
double sumc = 0, C_sumc = 1000;
|
||||
mxArray *B1_inv = NULL;
|
||||
mxArray *B1_inv_t = NULL;
|
||||
|
@ -1815,7 +1808,6 @@ SparseMatrix::Solve_Matlab_Relaxation(mxArray *A_m, mxArray *b_m, unsigned int S
|
|||
sumc = 0;
|
||||
for (unsigned int i = 0; i < B_inv_nze; i++)
|
||||
sumc += fabs(B_inv_d[i]);
|
||||
last_t = t;
|
||||
}
|
||||
B1_inv_t = Sparse_transpose(B1_inv);
|
||||
mxArray *S1 = Sparse_mult_SAT_SB(B1_inv_t, C1);
|
||||
|
@ -2252,7 +2244,6 @@ SparseMatrix::Solve_ByteCode_Sparse_GaussianElimination(int Size, int blck, bool
|
|||
}
|
||||
}
|
||||
double markovitz = 0, markovitz_max = -9e70;
|
||||
int NR_max = 0;
|
||||
if (!one)
|
||||
{
|
||||
for (int j = 0; j < l; j++)
|
||||
|
@ -2277,7 +2268,6 @@ SparseMatrix::Solve_ByteCode_Sparse_GaussianElimination(int Size, int blck, bool
|
|||
pivj = pivj_v[j]; //Line number
|
||||
pivk = pivk_v[j]; //positi
|
||||
markovitz_max = markovitz;
|
||||
NR_max = NR[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2305,7 +2295,6 @@ SparseMatrix::Solve_ByteCode_Sparse_GaussianElimination(int Size, int blck, bool
|
|||
pivj = pivj_v[j]; //Line number
|
||||
pivk = pivk_v[j]; //positi
|
||||
markovitz_max = markovitz;
|
||||
NR_max = NR[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2411,11 +2400,11 @@ SparseMatrix::Solve_ByteCode_Sparse_GaussianElimination(int Size, int blck, bool
|
|||
u[b[row]] -= u[b[pivj]]*first_elem;
|
||||
}
|
||||
}
|
||||
double slowc_lbx = slowc, res1bx;
|
||||
double slowc_lbx = slowc;
|
||||
for (int i = 0; i < y_size; i++)
|
||||
ya[i+it_*y_size] = y[i+it_*y_size];
|
||||
slowc_save = slowc;
|
||||
res1bx = simple_bksub(it_, Size, slowc_lbx);
|
||||
simple_bksub(it_, Size, slowc_lbx);
|
||||
End_GE(Size);
|
||||
mxFree(piv_v);
|
||||
mxFree(pivj_v);
|
||||
|
@ -2901,11 +2890,11 @@ SparseMatrix::Solve_ByteCode_Symbolic_Sparse_GaussianElimination(int Size, bool
|
|||
}
|
||||
|
||||
/*The backward substitution*/
|
||||
double slowc_lbx = slowc, res1bx;
|
||||
double slowc_lbx = slowc;
|
||||
for (int i = 0; i < y_size*(periods+y_kmin); i++)
|
||||
ya[i] = y[i];
|
||||
slowc_save = slowc;
|
||||
res1bx = bksub(tbreak, last_period, Size, slowc_lbx);
|
||||
bksub(tbreak, last_period, Size, slowc_lbx);
|
||||
End_GE(Size);
|
||||
}
|
||||
|
||||
|
|
|
@ -104,12 +104,12 @@ private:
|
|||
void CheckIt(int y_size, int y_kmin, int y_kmax, int Size, int periods, int iter);
|
||||
void Check_the_Solution(int periods, int y_kmin, int y_kmax, int Size, double *u, int *pivot, int *b);
|
||||
int complete(int beg_t, int Size, int periods, int *b);
|
||||
double bksub(int tbreak, int last_period, int Size, double slowc_l
|
||||
void bksub(int tbreak, int last_period, int Size, double slowc_l
|
||||
#ifdef PROFILER
|
||||
, long int *nmul
|
||||
#endif
|
||||
);
|
||||
double simple_bksub(int it_, int Size, double slowc_l);
|
||||
void simple_bksub(int it_, int Size, double slowc_l);
|
||||
mxArray *Sparse_transpose(mxArray *A_m);
|
||||
mxArray *Sparse_mult_SAT_SB(mxArray *A_m, mxArray *B_m);
|
||||
mxArray *Sparse_mult_SAT_B(mxArray *A_m, mxArray *B_m);
|
||||
|
|
|
@ -205,7 +205,7 @@ main(int nrhs, const char *prhs[])
|
|||
#endif
|
||||
//ErrorHandlingException error_handling;
|
||||
unsigned int i, row_y = 0, col_y = 0, row_x = 0, col_x = 0, nb_row_xd = 0;
|
||||
unsigned int steady_row_y, steady_col_y, steady_row_x, steady_col_x, steady_nb_row_xd;
|
||||
unsigned int steady_row_y, steady_col_y;
|
||||
int y_kmin = 0, y_kmax = 0, y_decal = 0;
|
||||
unsigned int periods = 1;
|
||||
double *direction;
|
||||
|
@ -265,12 +265,9 @@ main(int nrhs, const char *prhs[])
|
|||
{
|
||||
steady_yd = mxGetPr(mxGetFieldByNumber(oo_, 0, mxGetFieldNumber(oo_, "steady_state")));
|
||||
steady_row_y = mxGetM(mxGetFieldByNumber(oo_, 0, mxGetFieldNumber(oo_, "steady_state")));
|
||||
steady_col_y = mxGetN(mxGetFieldByNumber(oo_, 0, mxGetFieldNumber(oo_, "steady_state")));;
|
||||
steady_col_y = mxGetN(mxGetFieldByNumber(oo_, 0, mxGetFieldNumber(oo_, "steady_state")));;
|
||||
}
|
||||
steady_xd = mxGetPr(mxGetFieldByNumber(oo_, 0, mxGetFieldNumber(oo_, "exo_steady_state")));
|
||||
steady_row_x = mxGetM(mxGetFieldByNumber(oo_, 0, mxGetFieldNumber(oo_, "exo_steady_state")));
|
||||
steady_col_x = mxGetN(mxGetFieldByNumber(oo_, 0, mxGetFieldNumber(oo_, "exo_steady_state")));
|
||||
steady_nb_row_xd = steady_row_x;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -342,11 +339,11 @@ main(int nrhs, const char *prhs[])
|
|||
mxFree(fname);
|
||||
int nb_blocks = 0;
|
||||
double *pind;
|
||||
bool result = true, no_error = true;
|
||||
bool no_error = true;
|
||||
|
||||
try
|
||||
{
|
||||
result = interprete.compute_blocks(f, f, steady_state, evaluate, block, nb_blocks,print_it);
|
||||
interprete.compute_blocks(f, f, steady_state, evaluate, block, nb_blocks,print_it);
|
||||
}
|
||||
catch (GeneralExceptionHandling &feh)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue