Skip to content
Snippets Groups Projects
Verified Commit cea9a851 authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Bug fix in SEP with sparse and perfect tree.

The initial condition of the state variables was not updated in each iteration.
parent b9b50dbc
No related branches found
No related tags found
No related merge requests found
......@@ -39,7 +39,7 @@ i_hc = i_cols_f - 2*ny;
nzA = cell(periods,world_nbr);
res = zeros(ny,periods,world_nbr);
Y = pfm.Y; %zeros(ny*(periods+2),world_nbr);
Y = zeros(ny*(periods+2),world_nbr);
Y(1:ny,1) = pfm.y0;
Y(end-ny+1:end,:) = repmat(steady_state,1,world_nbr);
Y(pfm.i_upd_y) = y;
......
......@@ -78,7 +78,6 @@ if update_pfm_struct
[~, jacobian] = dynamic_model(z, exo_simul, pfm.params, pfm.steady_state, 2);
world_nbr = nnodes^order;
Y = repmat(endo_simul(:),1,world_nbr);
% The columns of A map the elements of Y such that
% each block of Y with ny rows are unfolded column wise
......@@ -142,12 +141,13 @@ if update_pfm_struct
pfm.i_cols_T = i_cols_T;
pfm.i_upd_r = i_upd_r;
pfm.i_upd_y = i_upd_y;
pfm.Y = Y;
pfm.dimension = dimension;
end
pfm.Y = repmat(endo_simul(:),1,pfm.world_nbr);
y = repmat(pfm.steady_state, pfm.dimension/pfm.ny, 1);
if update_options_struct
......
......@@ -72,9 +72,6 @@ if update_pfm_struct
% The third row block is ny x nnodes^2
% and so on until size ny x nnodes^order
world_nbr = pfm.world_nbr;
% Y = endo_simul(:,2:end-1);
pfm.Y = repmat(endo_simul(:), 1, world_nbr);
pfm.y0 = endo_simul(:,1);
% The columns of A map the elements of Y such that
% each block of Y with ny rows are unfolded column wise
......@@ -133,5 +130,7 @@ if update_options_struct
end
end
pfm.y0 = endo_simul(:,1);
[y, errorflag, ~, ~, errorcode] = dynare_solve(@ep_problem_2, y, options_.simul.maxit, options_.dynatol.f, options_.dynatol.x, options_, exo_simul, pfm);
endo_simul(:,2) = y(1:pfm.ny);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment