Bytecode: remove incomplete/buggy support for exogenous deterministic
parent
888a87312d
commit
b3cff2d34d
|
@ -172,7 +172,7 @@ public:
|
|||
double *y, *ya;
|
||||
int y_size;
|
||||
double *T;
|
||||
int nb_row_xd, nb_row_x, col_x, col_y;
|
||||
int nb_row_x, col_x, col_y;
|
||||
int y_kmin, y_kmax, periods;
|
||||
double *x, *params;
|
||||
double *u;
|
||||
|
@ -304,12 +304,14 @@ public:
|
|||
mexPrintf("=> Unknown endogenous variable # %d", variable_num);
|
||||
break;
|
||||
case SymbolType::exogenous:
|
||||
case SymbolType::exogenousDet:
|
||||
if (variable_num < P_exo_names.size())
|
||||
return P_exo_names[variable_num];
|
||||
else
|
||||
mexPrintf("=> Unknown exogenous variable # %d", variable_num);
|
||||
break;
|
||||
case SymbolType::exogenousDet:
|
||||
mexErrMsgTxt("get_variable: exogenous deterministic not supported");
|
||||
break;
|
||||
case SymbolType::parameter:
|
||||
if (variable_num < P_param_names.size())
|
||||
return P_param_names[variable_num];
|
||||
|
@ -523,16 +525,7 @@ public:
|
|||
Stackf.push(x[it_+lag+var*nb_row_x]);
|
||||
break;
|
||||
case SymbolType::exogenousDet:
|
||||
var = static_cast<FLDV_ *>(it_code->second)->get_pos();
|
||||
lag = static_cast<FLDV_ *>(it_code->second)->get_lead_lag();
|
||||
tmp_out.str("");
|
||||
if (lag != 0)
|
||||
tmp_out << get_variable(SymbolType::exogenousDet, var) << "(" << lag << ")";
|
||||
else
|
||||
tmp_out << get_variable(SymbolType::exogenousDet, var);
|
||||
Stack.push(tmp_out.str());
|
||||
if (compute)
|
||||
Stackf.push(x[it_+lag+var*nb_row_xd]);
|
||||
mexErrMsgTxt("FLDV: exogenous deterministic not supported");
|
||||
break;
|
||||
case SymbolType::modelLocalVariable:
|
||||
break;
|
||||
|
@ -574,10 +567,7 @@ public:
|
|||
Stackf.push(x[var]);
|
||||
break;
|
||||
case SymbolType::exogenousDet:
|
||||
var = static_cast<FLDSV_ *>(it_code->second)->get_pos();
|
||||
Stack.push(get_variable(SymbolType::exogenousDet, var));
|
||||
if (compute)
|
||||
Stackf.push(x[var]);
|
||||
mexErrMsgTxt("FLDSV: exogenous deterministic not supported");
|
||||
break;
|
||||
case SymbolType::modelLocalVariable:
|
||||
break;
|
||||
|
@ -702,21 +692,7 @@ public:
|
|||
}
|
||||
break;
|
||||
case SymbolType::exogenousDet:
|
||||
var = static_cast<FSTPV_ *>(it_code->second)->get_pos();
|
||||
lag = static_cast<FSTPV_ *>(it_code->second)->get_lead_lag();
|
||||
tmp_out2.str("");
|
||||
tmp_out2 << Stack.top();
|
||||
tmp_out.str("");
|
||||
tmp_out << get_variable(SymbolType::exogenousDet, var);
|
||||
if (lag != 0)
|
||||
tmp_out << "(" << lag << ")";
|
||||
tmp_out << " = " << tmp_out2.str();
|
||||
Stack.pop();
|
||||
if (compute)
|
||||
{
|
||||
x[it_+lag+var*nb_row_xd] = Stackf.top();
|
||||
Stackf.pop();
|
||||
}
|
||||
mexErrMsgTxt("FSTPV: exogenous deterministic not supported");
|
||||
break;
|
||||
default:
|
||||
mexPrintf("FSTPV: Unknown variable type\n");
|
||||
|
@ -756,7 +732,6 @@ public:
|
|||
}
|
||||
break;
|
||||
case SymbolType::exogenous:
|
||||
case SymbolType::exogenousDet:
|
||||
var = static_cast<FSTPSV_ *>(it_code->second)->get_pos();
|
||||
tmp_out2.str("");
|
||||
tmp_out2 << Stack.top();
|
||||
|
@ -770,6 +745,9 @@ public:
|
|||
Stackf.pop();
|
||||
}
|
||||
break;
|
||||
case SymbolType::exogenousDet:
|
||||
mexErrMsgTxt("FSTPSV: exogenous deterministic not supported");
|
||||
break;
|
||||
default:
|
||||
mexPrintf("FSTPSV: Unknown variable type\n");
|
||||
}
|
||||
|
|
|
@ -242,9 +242,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative)
|
|||
Stack.push(x[it_+lag+var*nb_row_x]);
|
||||
break;
|
||||
case SymbolType::exogenousDet:
|
||||
var = static_cast<FLDV_ *>(it_code->second)->get_pos();
|
||||
lag = static_cast<FLDV_ *>(it_code->second)->get_lead_lag();
|
||||
Stack.push(x[it_+lag+var*nb_row_xd]);
|
||||
mexErrMsgTxt("FLDV: exogenous deterministic not supported");
|
||||
break;
|
||||
case SymbolType::modelLocalVariable:
|
||||
#ifdef DEBUG
|
||||
|
@ -288,11 +286,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative)
|
|||
Stack.push(x[var]);
|
||||
break;
|
||||
case SymbolType::exogenousDet:
|
||||
var = static_cast<FLDSV_ *>(it_code->second)->get_pos();
|
||||
#ifdef DEBUG
|
||||
mexPrintf("FLDSV xd[var=%d]\n", var);
|
||||
#endif
|
||||
Stack.push(x[var]);
|
||||
mexErrMsgTxt("FLDSV: exogenous deterministic not supported");
|
||||
break;
|
||||
case SymbolType::modelLocalVariable:
|
||||
#ifdef DEBUG
|
||||
|
@ -330,11 +324,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative)
|
|||
Stack.push(x[var]);
|
||||
break;
|
||||
case SymbolType::exogenousDet:
|
||||
var = static_cast<FLDVS_ *>(it_code->second)->get_pos();
|
||||
#ifdef DEBUG
|
||||
mexPrintf("FLDVS xd[%d]\n", var);
|
||||
#endif
|
||||
Stack.push(x[var]);
|
||||
mexErrMsgTxt("FLDVS: exogenous deterministic not supported");
|
||||
break;
|
||||
case SymbolType::modelLocalVariable:
|
||||
#ifdef DEBUG
|
||||
|
@ -450,15 +440,7 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative)
|
|||
Stack.pop();
|
||||
break;
|
||||
case SymbolType::exogenousDet:
|
||||
var = static_cast<FSTPV_ *>(it_code->second)->get_pos();
|
||||
lag = static_cast<FSTPV_ *>(it_code->second)->get_lead_lag();
|
||||
x[it_+lag+var*nb_row_xd] = Stack.top();
|
||||
#ifdef DEBUG
|
||||
tmp_out << "=>";
|
||||
mexPrintf(" x[%d, %d](%f)=%s\n", it_+lag, var, x[it_+lag+var*nb_row_xd], tmp_out.str().c_str());
|
||||
tmp_out.str("");
|
||||
#endif
|
||||
Stack.pop();
|
||||
mexErrMsgTxt("FSTPV: exogenous deterministic not supported");
|
||||
break;
|
||||
default:
|
||||
mexPrintf("FSTPV: Unknown variable type\n");
|
||||
|
@ -484,7 +466,6 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative)
|
|||
Stack.pop();
|
||||
break;
|
||||
case SymbolType::exogenous:
|
||||
case SymbolType::exogenousDet:
|
||||
var = static_cast<FSTPSV_ *>(it_code->second)->get_pos();
|
||||
x[var] = Stack.top();
|
||||
#ifdef DEBUG
|
||||
|
@ -494,6 +475,9 @@ Evaluate::compute_block_time(int Per_u_, bool evaluate, bool no_derivative)
|
|||
#endif
|
||||
Stack.pop();
|
||||
break;
|
||||
case SymbolType::exogenousDet:
|
||||
mexErrMsgTxt("FSTPSV: exogenous deterministic not supported");
|
||||
break;
|
||||
default:
|
||||
mexPrintf("FSTPSV: Unknown variable type\n");
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ constexpr double BIG = 1.0e+8, SMALL = 1.0e-5;
|
|||
|
||||
Interpreter::Interpreter(double *params_arg, double *y_arg, double *ya_arg, double *x_arg, double *steady_y_arg, double *steady_x_arg,
|
||||
double *direction_arg, size_t y_size_arg,
|
||||
size_t nb_row_x_arg, size_t nb_row_xd_arg, int periods_arg, int y_kmin_arg, int y_kmax_arg,
|
||||
size_t nb_row_x_arg, int periods_arg, int y_kmin_arg, int y_kmax_arg,
|
||||
int maxit_arg_, double solve_tolf_arg, size_t size_of_direction_arg, int y_decal_arg, double markowitz_c_arg,
|
||||
string &filename_arg, int minimal_solving_periods_arg, int stack_solve_algo_arg, int solve_algo_arg,
|
||||
bool global_temporary_terms_arg, bool print_arg, bool print_error_arg, mxArray *GlobalTemporaryTerms_arg,
|
||||
|
@ -42,7 +42,6 @@ Interpreter::Interpreter(double *params_arg, double *y_arg, double *ya_arg, doub
|
|||
steady_x = steady_x_arg;
|
||||
direction = direction_arg;
|
||||
nb_row_x = nb_row_x_arg;
|
||||
nb_row_xd = nb_row_xd_arg;
|
||||
periods = periods_arg;
|
||||
maxit_ = maxit_arg_;
|
||||
solve_tolf = solve_tolf_arg;
|
||||
|
|
|
@ -45,7 +45,7 @@ protected:
|
|||
public:
|
||||
Interpreter(double *params_arg, double *y_arg, double *ya_arg, double *x_arg, double *steady_y_arg, double *steady_x_arg,
|
||||
double *direction_arg, size_t y_size_arg,
|
||||
size_t nb_row_x_arg, size_t nb_row_xd_arg, int periods_arg, int y_kmin_arg, int y_kmax_arg,
|
||||
size_t nb_row_x_arg, int periods_arg, int y_kmin_arg, int y_kmax_arg,
|
||||
int maxit_arg_, double solve_tolf_arg, size_t size_of_direction_arg, int y_decal_arg, double markowitz_c_arg,
|
||||
string &filename_arg, int minimal_solving_periods_arg, int stack_solve_algo_arg, int solve_algo_arg,
|
||||
bool global_temporary_terms_arg, bool print_arg, bool print_error_arg, mxArray *GlobalTemporaryTerms_arg,
|
||||
|
|
|
@ -199,7 +199,7 @@ mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
|
|||
mxArray *block_structur = nullptr;
|
||||
mxArray *pfplan_struct = nullptr;
|
||||
ErrorMsg error_msg;
|
||||
size_t i, row_y = 0, col_y = 0, row_x = 0, col_x = 0, nb_row_xd = 0;
|
||||
size_t i, row_y = 0, col_y = 0, row_x = 0, col_x = 0;
|
||||
size_t steady_row_y, steady_col_y;
|
||||
int y_kmin = 0, y_kmax = 0, y_decal = 0;
|
||||
unsigned int periods = 1;
|
||||
|
@ -419,10 +419,10 @@ mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
|
|||
splan[i].var = name;
|
||||
SymbolType variable_type = SymbolType::endogenous;
|
||||
int exo_num = emsg.get_ID(name, &variable_type);
|
||||
if (variable_type == SymbolType::exogenous || variable_type == SymbolType::exogenousDet)
|
||||
if (variable_type == SymbolType::exogenous)
|
||||
splan[i].var_num = exo_num;
|
||||
else
|
||||
mexErrMsgTxt(("The variable '"s + name + "' defined as var in plan is not an exogenous or a deterministic exogenous\n").c_str());
|
||||
mexErrMsgTxt(("The variable '"s + name + "' defined as var in plan is not an exogenous\n").c_str());
|
||||
}
|
||||
tmp = mxGetField(plan_struct, i, "var");
|
||||
if (tmp)
|
||||
|
@ -481,10 +481,10 @@ mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
|
|||
spfplan[i].var = name;
|
||||
SymbolType variable_type = SymbolType::endogenous;
|
||||
int exo_num = emsg.get_ID(name, &variable_type);
|
||||
if (variable_type == SymbolType::exogenous || variable_type == SymbolType::exogenousDet)
|
||||
if (variable_type == SymbolType::exogenous)
|
||||
splan[i].var_num = exo_num;
|
||||
else
|
||||
mexErrMsgTxt(("The variable '"s + name + "' defined as var in pfplan is not an exogenous or a deterministic exogenous\n").c_str());
|
||||
mexErrMsgTxt(("The variable '"s + name + "' defined as var in pfplan is not an exogenous\n").c_str());
|
||||
}
|
||||
tmp = mxGetField(pfplan_struct, i, "exo");
|
||||
if (tmp)
|
||||
|
@ -551,7 +551,6 @@ mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
|
|||
xd = mxGetPr(exo_sim_arr);
|
||||
row_x = mxGetM(exo_sim_arr);
|
||||
col_x = mxGetN(exo_sim_arr);
|
||||
nb_row_xd = row_x;
|
||||
}
|
||||
int field = mxGetFieldNumber(M_, "maximum_lag");
|
||||
if (field >= 0)
|
||||
|
@ -600,7 +599,6 @@ mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
|
|||
xd = mxGetPr(exo_steady_state_arr);
|
||||
row_x = mxGetM(exo_steady_state_arr);
|
||||
col_x = mxGetN(exo_steady_state_arr);
|
||||
nb_row_xd = row_x;
|
||||
}
|
||||
}
|
||||
int field = mxGetFieldNumber(options_, "verbosity");
|
||||
|
@ -718,7 +716,7 @@ mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
|
|||
size_t nb_row_x = row_x;
|
||||
|
||||
clock_t t0 = clock();
|
||||
Interpreter interprete(params, y, ya, x, steady_yd, steady_xd, direction, y_size, nb_row_x, nb_row_xd, periods, y_kmin, y_kmax, maxit_, solve_tolf, size_of_direction, y_decal,
|
||||
Interpreter interprete(params, y, ya, x, steady_yd, steady_xd, direction, y_size, nb_row_x, periods, y_kmin, y_kmax, maxit_, solve_tolf, size_of_direction, y_decal,
|
||||
markowitz_c, file_name, minimal_solving_periods, stack_solve_algo, solve_algo, global_temporary_terms, print, print_error, GlobalTemporaryTerms, steady_state,
|
||||
print_it, col_x, col_y);
|
||||
string f(fname);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Test for varexo_det and forecast command at order 1
|
||||
// Test for varexo_det and forecast command at order 1 with bytecode
|
||||
|
||||
var y, c, k, a, h, b;
|
||||
varexo e,u;
|
||||
|
@ -16,8 +16,7 @@ theta = 2.95;
|
|||
|
||||
phi = 0.1;
|
||||
|
||||
//model(bytecode);
|
||||
model;
|
||||
model(bytecode);
|
||||
c*theta*h^(1+psi)=(1-alpha)*y;
|
||||
k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1)))
|
||||
*(exp(b(+1))*alpha*y(+1)+(1-delta)*k));
|
||||
|
@ -40,7 +39,6 @@ ahat = 0;
|
|||
bhat = 0;
|
||||
end;
|
||||
|
||||
//simul(periods=20);
|
||||
shocks;
|
||||
var e; stderr 0.009;
|
||||
var u; stderr 0.009;
|
||||
|
|
Loading…
Reference in New Issue