Simplify the interface to perfect_foresight_problem MEX

parent 984c60ac
......@@ -188,10 +188,8 @@ if ~isreal(oo_.endo_simul(:)) % cannot happen with bytecode or the perfect_fores
yT = NaN(ny, 1);
end
yy = real(oo_.endo_simul(:,M_.maximum_lag+(1:periods)));
model_dynamic_g1_nz = str2func([M_.fname,'.dynamic_g1_nz']);
[nzij_pred, nzij_current, nzij_fwrd] = model_dynamic_g1_nz();
residuals = perfect_foresight_problem(yy(:), M_.fname, sum(M_.dynamic_tmp_nbr(1:2)), y0, yT, oo_.exo_simul, M_.params, oo_.steady_state, periods, M_.endo_nbr, M_.maximum_lag, M_.maximum_endo_lag, M_.lead_lag_incidence, nzij_pred, nzij_current, nzij_fwrd, M_.has_external_function, options_.use_dll, options_.threads.perfect_foresight_problem);
residuals = perfect_foresight_problem(yy(:), y0, yT, oo_.exo_simul, M_.params, oo_.steady_state, periods, M_, options_);
if max(abs(residuals))< options_.dynatol.f
oo_.deterministic_simulation.status = 1;
......
......@@ -141,10 +141,8 @@ if nargout>1
yT = NaN(ny, 1);
end
yy = oo_.endo_simul(:,M_.maximum_lag+(1:periods));
model_dynamic_g1_nz = str2func([M_.fname,'.dynamic_g1_nz']);
[nzij_pred, nzij_current, nzij_fwrd] = model_dynamic_g1_nz();
residuals = perfect_foresight_problem(yy(:), M_.fname, sum(M_.dynamic_tmp_nbr(1:2)), y0, yT, oo_.exo_simul, M_.params, oo_.steady_state, periods, M_.endo_nbr, M_.maximum_lag, M_.maximum_endo_lag, M_.lead_lag_incidence, nzij_pred, nzij_current, nzij_fwrd, M_.has_external_function, options_.use_dll, options_.threads.perfect_foresight_problem);
residuals = perfect_foresight_problem(yy(:), y0, yT, oo_.exo_simul, M_.params, oo_.steady_state, periods, M_, options_);
end
maxerror = max(max(abs(residuals)));
end
......
......@@ -59,15 +59,12 @@ if verbose
skipline()
end
model_dynamic_g1_nz = str2func([M.fname,'.dynamic_g1_nz']);
[nzij_pred, nzij_current, nzij_fwrd] = model_dynamic_g1_nz();
h1 = clock;
for iter = 1:options.simul.maxit
h2 = clock;
[res, A] = perfect_foresight_problem(y, M.fname, sum(M.dynamic_tmp_nbr(1:2)), y0, yT, exogenousvariables, M.params, steadystate, periods, ny, M.maximum_lag, M.maximum_endo_lag, M.lead_lag_incidence, nzij_pred, nzij_current, nzij_fwrd, M.has_external_function, options.use_dll, options.threads.perfect_foresight_problem);
[res, A] = perfect_foresight_problem(y, y0, yT, exogenousvariables, M.params, steadystate, periods, M, options);
if options.endogenous_terminal_period && iter > 1
for it = 1:periods
......
......@@ -53,10 +53,7 @@ if (options.solve_algo == 10 || options.solve_algo == 11)% mixed complementarity
i_cols_J1, i_cols_1, i_cols_T, i_cols_j, i_cols_0, i_cols_J0, ...
eq_index);
else
model_dynamic_g1_nz = str2func([M.fname,'.dynamic_g1_nz']);
[nzij_pred, nzij_current, nzij_fwrd] = model_dynamic_g1_nz();
[y, check] = dynare_solve(@perfect_foresight_problem,z(:), options, M.fname, sum(M.dynamic_tmp_nbr(1:2)), y0, yT, exogenousvariables, M.params, steadystate, options.periods, M.endo_nbr, M.maximum_lag, M.maximum_endo_lag, M.lead_lag_incidence, nzij_pred, nzij_current, nzij_fwrd, M.has_external_function, options.use_dll, options.threads.perfect_foresight_problem);
[y, check] = dynare_solve(@perfect_foresight_problem,z(:), options, y0, yT, exogenousvariables, M.params, steadystate, options.periods, M, options);
end
if all(imag(y)<.1*options.dynatol.x)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment