Commit 5a36d57b by Sébastien Villemot

### Perfect foresight: remove unused nnzJ argument in several stacked problem functions

parent 088826a3
Pipeline #1229 passed with stages
in 65 minutes and 33 seconds
 function [residuals,JJacobian] = linear_perfect_foresight_problem(y, dynamicjacobian, Y0, YT, ... function [residuals,JJacobian] = linear_perfect_foresight_problem(y, dynamicjacobian, Y0, YT, ... exo_simul, params, steady_state, maximum_lag, T, ny, i_cols, ... exo_simul, params, steady_state, maximum_lag, T, ny, i_cols, ... i_cols_J1, i_cols_1, i_cols_T, i_cols_j, i_cols_0, i_cols_J0, nnzJ, jendo, jexog) i_cols_J1, i_cols_1, i_cols_T, i_cols_j, i_cols_0, i_cols_J0, jendo, jexog) % Computes the residuals and the Jacobian matrix for a linear perfect foresight problem over T periods. % Computes the residuals and the Jacobian matrix for a linear perfect foresight problem over T periods. % % ... ...
 ... @@ -2,12 +2,12 @@ function [residuals,JJacobian] = perfect_foresight_mcp_problem(y, dynamic_functi ... @@ -2,12 +2,12 @@ function [residuals,JJacobian] = perfect_foresight_mcp_problem(y, dynamic_functi exo_simul, params, steady_state, ... exo_simul, params, steady_state, ... maximum_lag, T, ny, i_cols, ... maximum_lag, T, ny, i_cols, ... i_cols_J1, i_cols_1, i_cols_T, ... i_cols_J1, i_cols_1, i_cols_T, ... i_cols_j, i_cols_0,i_cols_J0, nnzJ,eq_index) i_cols_j, i_cols_0,i_cols_J0, eq_index) % function [residuals,JJacobian] = perfect_foresight_mcp_problem(y, dynamic_function, Y0, YT, ... % function [residuals,JJacobian] = perfect_foresight_mcp_problem(y, dynamic_function, Y0, YT, ... % exo_simul, params, steady_state, ... % exo_simul, params, steady_state, ... % maximum_lag, T, ny, i_cols, ... % maximum_lag, T, ny, i_cols, ... % i_cols_J1, i_cols_1, i_cols_T, ... % i_cols_J1, i_cols_1, i_cols_T, ... % i_cols_j,nnzJ,eq_index) % i_cols_j,eq_index) % Computes the residuals and the Jacobian matrix for a perfect foresight problem over T periods % Computes the residuals and the Jacobian matrix for a perfect foresight problem over T periods % in a mixed complementarity problem context % in a mixed complementarity problem context % % ... @@ -33,7 +33,6 @@ function [residuals,JJacobian] = perfect_foresight_mcp_problem(y, dynamic_functi ... @@ -33,7 +33,6 @@ function [residuals,JJacobian] = perfect_foresight_mcp_problem(y, dynamic_functi % variables (relevant in last period) % variables (relevant in last period) % i_cols_j [double] indices of variables in M.lead_lag_incidence % i_cols_j [double] indices of variables in M.lead_lag_incidence % in dynamic Jacobian (relevant in intermediate periods) % in dynamic Jacobian (relevant in intermediate periods) % nnzJ [scalar] number of non-zero elements in Jacobian % eq_index [double] N*1 array, index vector describing residual mapping resulting % eq_index [double] N*1 array, index vector describing residual mapping resulting % from complementarity setup % from complementarity setup % OUTPUTS % OUTPUTS ... @@ -45,7 +44,7 @@ function [residuals,JJacobian] = perfect_foresight_mcp_problem(y, dynamic_functi ... @@ -45,7 +44,7 @@ function [residuals,JJacobian] = perfect_foresight_mcp_problem(y, dynamic_functi % SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS % None. % None. % Copyright (C) 1996-2017 Dynare Team % Copyright (C) 1996-2019 Dynare Team % % % This file is part of Dynare. % This file is part of Dynare. % % ... ...
 ... @@ -2,7 +2,7 @@ function [residuals,JJacobian] = perfect_foresight_problem(y, dynamic_function, ... @@ -2,7 +2,7 @@ function [residuals,JJacobian] = perfect_foresight_problem(y, dynamic_function, exo_simul, params, steady_state, ... exo_simul, params, steady_state, ... maximum_lag, T, ny, i_cols, ... maximum_lag, T, ny, i_cols, ... i_cols_J1, i_cols_1, i_cols_T, ... i_cols_J1, i_cols_1, i_cols_T, ... i_cols_j, i_cols_0, i_cols_J0, nnzJ) i_cols_j, i_cols_0, i_cols_J0) % Computes the residuals and the Jacobian matrix for a perfect foresight problem over T periods. % Computes the residuals and the Jacobian matrix for a perfect foresight problem over T periods. % % ... @@ -31,7 +31,6 @@ function [residuals,JJacobian] = perfect_foresight_problem(y, dynamic_function, ... @@ -31,7 +31,6 @@ function [residuals,JJacobian] = perfect_foresight_problem(y, dynamic_function, % - i_cols_0 [double] indices of contemporaneous variables in M.lead_lag_incidence in dynamic % - i_cols_0 [double] indices of contemporaneous variables in M.lead_lag_incidence in dynamic % Jacobian (relevant in problems with periods=1) % Jacobian (relevant in problems with periods=1) % - i_cols_J0 [double] indices of contemporaneous variables appearing in M.lead_lag_incidence (relevant in problems with periods=1) % - i_cols_J0 [double] indices of contemporaneous variables appearing in M.lead_lag_incidence (relevant in problems with periods=1) % - nnzJ [scalar] number of non-zero elements in Jacobian % % % OUTPUTS % OUTPUTS % - residuals [double] (N*T)*1 array, residuals of the stacked problem % - residuals [double] (N*T)*1 array, residuals of the stacked problem ... ...
 ... @@ -12,7 +12,7 @@ function perfect_foresight_solver() ... @@ -12,7 +12,7 @@ function perfect_foresight_solver() % SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS % none % none % Copyright (C) 1996-2018 Dynare Team % Copyright (C) 1996-2019 Dynare Team % % % This file is part of Dynare. % This file is part of Dynare. % % ... @@ -195,8 +195,7 @@ if ~isreal(oo_.endo_simul(:)) % can only happen without bytecode ... @@ -195,8 +195,7 @@ if ~isreal(oo_.endo_simul(:)) % can only happen without bytecode residuals = perfect_foresight_problem(yy(:),str2func([M_.fname '.dynamic']), y0, yT, ... residuals = perfect_foresight_problem(yy(:),str2func([M_.fname '.dynamic']), y0, yT, ... oo_.exo_simul,M_.params,oo_.steady_state, ... oo_.exo_simul,M_.params,oo_.steady_state, ... M_.maximum_lag, periods, M_.endo_nbr, i_cols, ... M_.maximum_lag, periods, M_.endo_nbr, i_cols, ... i_cols_J1, i_cols_1, i_cols_T, i_cols_j, i_cols_0, i_cols_J0, ... i_cols_J1, i_cols_1, i_cols_T, i_cols_j, i_cols_0, i_cols_J0); M_.NNZDerivatives(1)); if max(abs(residuals))< options_.dynatol.f if max(abs(residuals))< options_.dynatol.f oo_.deterministic_simulation.status = 1; oo_.deterministic_simulation.status = 1; oo_.endo_simul=real(oo_.endo_simul); oo_.endo_simul=real(oo_.endo_simul); ... ...
 ... @@ -144,8 +144,7 @@ if nargout>1 ... @@ -144,8 +144,7 @@ if nargout>1 residuals = perfect_foresight_problem(yy(:),str2func([M_.fname '.dynamic']), y0, yT, ... residuals = perfect_foresight_problem(yy(:),str2func([M_.fname '.dynamic']), y0, yT, ... oo_.exo_simul,M_.params,oo_.steady_state, ... oo_.exo_simul,M_.params,oo_.steady_state, ... M_.maximum_lag, periods,M_.endo_nbr,i_cols, ... M_.maximum_lag, periods,M_.endo_nbr,i_cols, ... i_cols_J1, i_cols_1, i_cols_T, i_cols_j, i_cols_0, i_cols_J0, ... i_cols_J1, i_cols_1, i_cols_T, i_cols_j, i_cols_0, i_cols_J0); M_.NNZDerivatives(1)); end end maxerror = max(max(abs(residuals))); maxerror = max(max(abs(residuals))); end end ... ...
 function [endogenousvariables, info] = solve_stacked_linear_problem(endogenousvariables, exogenousvariables, steadystate_y, steadystate_x, M, options) function [endogenousvariables, info] = solve_stacked_linear_problem(endogenousvariables, exogenousvariables, steadystate_y, steadystate_x, M, options) % Copyright (C) 2015-2017 Dynare Team % Copyright (C) 2015-2019 Dynare Team % % % This file is part of Dynare. % This file is part of Dynare. % % ... @@ -46,7 +46,7 @@ x = bsxfun(@minus, exogenousvariables, steadystate_x'); ... @@ -46,7 +46,7 @@ x = bsxfun(@minus, exogenousvariables, steadystate_x'); x, M.params, steadystate_y, ... x, M.params, steadystate_y, ... M.maximum_lag, options.periods, M.endo_nbr, i_cols, ... M.maximum_lag, options.periods, M.endo_nbr, i_cols, ... i_cols_J1, i_cols_1, i_cols_T, i_cols_j, i_cols_0, i_cols_J0, ... i_cols_J1, i_cols_1, i_cols_T, i_cols_j, i_cols_0, i_cols_J0, ... M.NNZDerivatives(1), jendo, jexog); jendo, jexog); if all(imag(y)<.1*options.dynatol.x) if all(imag(y)<.1*options.dynatol.x) if ~isreal(y) if ~isreal(y) ... ...
 ... @@ -51,14 +51,13 @@ if (options.solve_algo == 10 || options.solve_algo == 11)% mixed complementarity ... @@ -51,14 +51,13 @@ if (options.solve_algo == 10 || options.solve_algo == 11)% mixed complementarity exogenousvariables, M.params, steadystate, ... exogenousvariables, M.params, steadystate, ... M.maximum_lag, options.periods, M.endo_nbr, i_cols, ... M.maximum_lag, options.periods, M.endo_nbr, i_cols, ... i_cols_J1, i_cols_1, i_cols_T, i_cols_j, i_cols_0, i_cols_J0, ... i_cols_J1, i_cols_1, i_cols_T, i_cols_j, i_cols_0, i_cols_J0, ... M.NNZDerivatives(1),eq_index); eq_index); else else [y, check] = dynare_solve(@perfect_foresight_problem,z(:),options, ... [y, check] = dynare_solve(@perfect_foresight_problem,z(:),options, ... dynamicmodel, y0, yT, ... dynamicmodel, y0, yT, ... exogenousvariables, M.params, steadystate, ... exogenousvariables, M.params, steadystate, ... M.maximum_lag, options.periods, M.endo_nbr, i_cols, ... M.maximum_lag, options.periods, M.endo_nbr, i_cols, ... i_cols_J1, i_cols_1, i_cols_T, i_cols_j, i_cols_0, i_cols_J0, ... i_cols_J1, i_cols_1, i_cols_T, i_cols_j, i_cols_0, i_cols_J0); M.NNZDerivatives(1)); end end if all(imag(y)<.1*options.dynatol.x) 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!