Skip to content
Snippets Groups Projects
Verified Commit 373346b0 authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

:bug: Perfect foresight with linear approximation: path for endogenous after...

:bug: Perfect foresight with linear approximation: path for endogenous after failure to converge was not centered

Also add a test for that codepath (linear_approximation + stack_solve_algo=0).

(partial and manually adapted cherry-pick from d2065889)
parent 30a6f53f
No related branches found
No related tags found
No related merge requests found
Pipeline #10932 passed
...@@ -239,7 +239,7 @@ end ...@@ -239,7 +239,7 @@ end
if any(isnan(res)) || any(isinf(res)) || any(isnan(Y)) || any(isinf(Y)) || ~isreal(res) || ~isreal(Y) if any(isnan(res)) || any(isinf(res)) || any(isnan(Y)) || any(isinf(Y)) || ~isreal(res) || ~isreal(Y)
success = false; % NaN or Inf occurred success = false; % NaN or Inf occurred
endogenousvariables = reshape(Y, ny, periods+maximum_lag+M_.maximum_lead); endogenousvariables = bsxfun(@plus, reshape(Y, ny, periods+maximum_lag+M_.maximum_lead), steadystate_y);
if verbose if verbose
skipline() skipline()
if ~isreal(res) || ~isreal(Y) if ~isreal(res) || ~isreal(Y)
......
...@@ -133,3 +133,15 @@ end ...@@ -133,3 +133,15 @@ end
if max(abs(endo_simul_0(:)-endo_simul_1(:)))>.01*options_.dynatol.f if max(abs(endo_simul_0(:)-endo_simul_1(:)))>.01*options_.dynatol.f
error('Something is wrong!') error('Something is wrong!')
end end
// Test stack_solve_algo=0+linear_approximation, which uses a different codepath than stack_solve_algo=7
perfect_foresight_setup(periods=300);
perfect_foresight_solver(linear_approximation, stack_solve_algo=0);
endo_simul_2 = oo_.endo_simul;
if ~oo_.deterministic_simulation.status
error('Perfect foresight simulation failed')
end
if max(abs(endo_simul_0(:)-endo_simul_2(:)))>.01*options_.dynatol.f
error('Something is wrong!')
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment