Commit 1b822a91 authored by MichelJuillard's avatar MichelJuillard
Browse files

fix calls to dynare_solve() when Jacobian of function must be computed

numerically. Fix call to dynare_solve() in simulation_core()
parent 025e7a13
......@@ -53,8 +53,12 @@ elseif options_.steadystate_flag
%solve for instrument, using univariate solver, starting at initial value for instrument
inst_val = csolve(nl_func,ys_init(k_inst),'',options_.solve_tolf,100);
else
%solve for instrument, using multivariate solver, starting at initial value for instrument
[inst_val,info1] = dynare_solve(nl_func,ys_init(k_inst),options_);
%solve for instrument, using multivariate solver, starting at
%initial value for instrument
opt = options_;
opt.jacobian_flag = 0;
[inst_val,info1] = dynare_solve(nl_func,ys_init(k_inst), ...
opt);
end
ys_init(k_inst) = inst_val;
exo_ss = [oo.exo_steady_state oo.exo_det_steady_state];
......@@ -63,7 +67,9 @@ elseif options_.steadystate_flag
else
n_var = M.orig_endo_nbr;
xx = oo.steady_state(1:n_var);
[xx,check] = dynare_solve(nl_func,xx,options_);
opt = options_;
opt.jacobian_flag = 0;
[xx,check] = dynare_solve(nl_func,xx,opt);
[junk,junk,steady_state] = nl_func(xx);
end
......
......@@ -89,7 +89,9 @@ else
% nonlinear models
if max(abs(feval(fh,dr.ys,[oo_.exo_steady_state; ...
oo_.exo_det_steady_state], M_.params))) > options_.dynatol.f
[dr.ys,check1] = dynare_solve(fh,dr.ys,options_,...
opt = options_;
opt.jacobian_flag = 0;
[dr.ys,check1] = dynare_solve(fh,dr.ys,opt,...
[oo_.exo_steady_state; ...
oo_.exo_det_steady_state], M_.params);
end
......
......@@ -87,7 +87,9 @@ if options_.ramsey_policy && options_.ACES_solver == 0
end
old_solve_algo = options_.solve_algo;
% options_.solve_algo = 1;
oo_.steady_state = dynare_solve('ramsey_static',oo_.steady_state,options_,M_,options_,oo_,it_);
opt = options_;
opt.jacobian_flag = 0;
oo_.steady_state = dynare_solve('ramsey_static',oo_.steady_state,opt,M_,options_,oo_,it_);
options_.solve_algo = old_solve_algo;
[junk,junk,multbar] = ramsey_static(oo_.steady_state,M_,options_,oo_,it_);
[jacobia_,M_] = ramsey_dynamic(oo_.steady_state,multbar,M_,options_,oo_,it_);
......
......@@ -79,7 +79,7 @@ else
illi = illi(:,2:3);
[i_cols_J1,junk,i_cols_1] = find(illi(:));
i_cols_T = nonzeros(M_.lead_lag_incidence(1:2,:)');
[y,info] = dynare_solve(@perfect_foresight_problem,z(:),1, ...
[y,info] = dynare_solve(@perfect_foresight_problem,z(:),options_, ...
str2func([M_.fname '_dynamic']),y0,yT, ...
oo_.exo_simul,M_.params,oo_.steady_state, ...
options_.periods,M_.endo_nbr,i_cols, ...
......
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