From ffaf6c85590553c65ff068fd32649202091ae199 Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer Date: Sat, 25 Nov 2023 19:13:55 +0100 Subject: [PATCH] ident_bruteforce.m: remove globals --- matlab/ident_bruteforce.m | 18 ++++++++---------- matlab/identification_analysis.m | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/matlab/ident_bruteforce.m b/matlab/ident_bruteforce.m index 34f311fb0..75229b4e8 100644 --- a/matlab/ident_bruteforce.m +++ b/matlab/ident_bruteforce.m @@ -1,5 +1,5 @@ -function [pars, cosnJ] = ident_bruteforce(J, max_dim_cova_group, TeX, name_tex, tittxt, tol_deriv) -% function [pars, cosnJ] = ident_bruteforce(J,n,TeX, pnames_TeX,tittxt) +function [pars, cosnJ] = ident_bruteforce(dname,fname,J, max_dim_cova_group, TeX, name_tex, tittxt, tol_deriv) +% [pars, cosnJ] = ident_bruteforce(dname,fname,J, max_dim_cova_group, TeX, name_tex, tittxt, tol_deriv) % ------------------------------------------------------------------------- % given the Jacobian matrix J of moment derivatives w.r.t. parameters % computes, for each column of J, the groups of columns from 1 to n that @@ -20,7 +20,7 @@ function [pars, cosnJ] = ident_bruteforce(J, max_dim_cova_group, TeX, name_tex, % This function is called by % * identification_analysis.m % ========================================================================= -% Copyright © 2009-2019 Dynare Team +% Copyright © 2009-2023 Dynare Team % % This file is part of Dynare. % @@ -38,20 +38,18 @@ function [pars, cosnJ] = ident_bruteforce(J, max_dim_cova_group, TeX, name_tex, % along with Dynare. If not, see . % ========================================================================= -global M_ options_ - -OutputDirectoryName = CheckPath('identification',M_.dname); +OutputDirectoryName = CheckPath('identification',dname); totparam_nbr = size(J,2); % number of parameters -if nargin<2 || isempty(max_dim_cova_group) +if nargin<4 || isempty(max_dim_cova_group) max_dim_cova_group = 4; % max n-tuple end -if nargin<3 || isempty(TeX) +if nargin<5 || isempty(TeX) TeX = 0; % no Tex output tittxt=''; end -if nargin < 6 +if nargin < 8 tol_deriv = 1.e-8; end @@ -87,7 +85,7 @@ for ll = 1:max_dim_cova_group end dyn_waitbar_close(h); if TeX - filename = [OutputDirectoryName '/' M_.fname '_collin_patterns_',tittxt1,'_' int2str(ll) '.tex']; + filename = [OutputDirectoryName '/' fname '_collin_patterns_',tittxt1,'_' int2str(ll) '.tex']; fidTeX = fopen(filename,'w'); fprintf(fidTeX,'%% TeX-table generated by ident_bruteforce (Dynare).\n'); fprintf(fidTeX,['%% Collinearity patterns with ',int2str(ll),' parameter(s): ',tittxt,'\n']); diff --git a/matlab/identification_analysis.m b/matlab/identification_analysis.m index 516e7f2ab..25c99e331 100644 --- a/matlab/identification_analysis.m +++ b/matlab/identification_analysis.m @@ -462,7 +462,7 @@ if info(1) == 0 %no errors in solution if advanced % here we do not normalize (i.e. we set norm_dMOMENTS=1) as the OLS in ident_bruteforce is very sensitive to norm_dMOMENTS - [ide_moments.pars, ide_moments.cosndMOMENTS] = ident_bruteforce(dMOMENTS(ind_dMOMENTS,:), max_dim_cova_group, options_.TeX, options_ident.name_tex, options_ident.tittxt, tol_deriv); + [ide_moments.pars, ide_moments.cosndMOMENTS] = ident_bruteforce(M_.dname,M_.fname,dMOMENTS(ind_dMOMENTS,:), max_dim_cova_group, options_.TeX, options_ident.name_tex, options_ident.tittxt, tol_deriv); end %here we focus on the unnormalized S and V, which is then used in plot_identification.m and for prior_mc > 1