From 4598dba40c959509b3157e258ef33b87cad1f41f Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer <jpfeifer@gmx.de> Date: Fri, 8 Sep 2023 14:57:22 +0200 Subject: [PATCH] display_static_residuals.m: remove globals --- matlab/display_static_residuals.m | 30 ++++++++---------------------- preprocessor | 2 +- 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/matlab/display_static_residuals.m b/matlab/display_static_residuals.m index fd7f9b8352..acdc9bd7ca 100644 --- a/matlab/display_static_residuals.m +++ b/matlab/display_static_residuals.m @@ -1,10 +1,13 @@ -function z = display_static_residuals(options_resid_) -% function z = display_static_residuals(options_resid_) +function z = display_static_residuals(M_, options_, oo_,options_resid_) +% function z = display_static_residuals(M_, options_, oo_,options_resid_) % % Computes static residuals associated with the guess values. % % INPUTS -% options_resid_: options to resid +% M: [structure] storing the model information +% options: [structure] storing the options +% oo: [structure] storing the results +% options_resid_: options to resid % % OUTPUTS % z: residuals @@ -29,11 +32,7 @@ function z = display_static_residuals(options_resid_) % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <https://www.gnu.org/licenses/>. -global M_ options_ oo_ - -% Properly handle the case where no input argument is given, e.g. when -% writing “z = resid;” in a .mod file (hence not using the preprocessor syntax). -non_zero = nargin > 0 && isfield(options_resid_, 'non_zero') && options_resid_.non_zero; +non_zero = (isfield(options_resid_, 'non_zero') && options_resid_.non_zero); tags = M_.equations_tags; istag = 0; @@ -41,15 +40,6 @@ if ~isempty(tags) istag = 1; end -steady_state_old = oo_.steady_state; - -% Keep of a copy of M_.Sigma_e -Sigma_e = M_.Sigma_e; - -% Set M_.Sigma_e=0 (we evaluate the *deterministic* static model) -M_.Sigma_e = zeros(size(Sigma_e)); - -info = 0; if any(imag(oo_.steady_state)) imagrow=find(imag(oo_.steady_state)); if ~isempty(imagrow) @@ -83,8 +73,6 @@ else disp_string=''; end end -M_.Sigma_e = Sigma_e; - % Display the non-zero residuals if no return value if nargout == 0 @@ -128,6 +116,4 @@ if nargout == 0 disp('All residuals are zero') end skipline(2) -end - -oo_.steady_state = steady_state_old; +end \ No newline at end of file diff --git a/preprocessor b/preprocessor index 140c91e911..ea34761795 160000 --- a/preprocessor +++ b/preprocessor @@ -1 +1 @@ -Subproject commit 140c91e91188ee701d4a185d1ad771c23999f491 +Subproject commit ea3476179591eed472a14a35570660bd643cca1e -- GitLab