Verified Commit 7a75872f authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Modernization: use tilde (~) syntax for ignored output arguments

parent ce49cd95
Pipeline #308 passed with stages
in 74 minutes and 36 seconds
......@@ -194,7 +194,7 @@ while fpar<B
end
if MAX_nirfs_dsgevar
IRUN = IRUN+1;
[fval,info,junk1,junk2,junk3,junk3,junk4,PHI,SIGMAu,iXX] = dsge_var_likelihood(deep',dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,bounds,oo_);
[fval,info,~,~,~,~,~,PHI,SIGMAu,iXX] = dsge_var_likelihood(deep',dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,bounds,oo_);
dsge_prior_weight = M_.params(strmatch('dsge_prior_weight', M_.param_names));
DSGE_PRIOR_WEIGHT = floor(dataset_.nobs*(1+dsge_prior_weight));
SIGMA_inv_upper_chol = chol(inv(SIGMAu*dataset_.nobs*(dsge_prior_weight+1)));
......
......@@ -93,7 +93,7 @@ for j=1:nvar
d0={};
z1 = squeeze(z(i_var(j),:,:));
if screen_shocks
[junk, isort] = sort(mean(abs(z1(1:end-2,:)')), 'descend');
[~, isort] = sort(mean(abs(z1(1:end-2,:)')), 'descend');
labels = char(char(shock_names(isort(1:16))),'Others', 'Initial values');
zres = sum(z1(isort(17:end),:),1);
z1 = [z1(isort(1:16),:); zres; z1(comp_nbr0:end,:)];
......
......@@ -128,7 +128,7 @@ if realtime_==0
myopts=options_;
myopts.plot_shock_decomp.type='qoq';
myopts.plot_shock_decomp.realtime=0;
[z, junk] = plot_shock_decomposition(M_,oo_,myopts,[]);
[z, ~] = plot_shock_decomposition(M_,oo_,myopts,[]);
else
z = oo_;
end
......@@ -287,7 +287,7 @@ if isstruct(aux)
yaux=aux.y;
end
[nvar , nterms, junk] = size(z);
[nvar, nterms, ~] = size(z);
for j=1:nvar
for k =1:nterms
ztmp = squeeze(z(j,k,min((t0-3):-4:1):end));
......
......@@ -40,7 +40,7 @@ irf = icc1+(options_.periods-1)*ny ;
d1 = zeros(options_.periods*ny,1) ;
ofs = (((options_.periods-1)*ny+1)-1)*jcf*8 ;
junk = fseek(fid,ofs,-1) ;
[~] = fseek(fid,ofs,-1) ;
c = fread(fid,[jcf,ny],'float64')';
d1(ir) = c(:,jcf) ;
......@@ -52,7 +52,7 @@ while i <= M_.maximum_lead || i <= options_.periods
irf1 = selif(irf,irf<=options_.periods*ny) ;
ofs = (((options_.periods-i)*ny+1)-1)*jcf*8 ;
junk = fseek(fid,ofs,-1) ;
[~] = fseek(fid,ofs,-1) ;
c = fread(fid,[jcf,ny],'float64')' ;
d1(ir) = c(:,jcf) - c(:,1:size(irf1,1))*d1(irf1) ;
......@@ -64,7 +64,7 @@ end
while i <= options_.periods
ofs = (((options_.periods-i)*ny+1)-1)*jcf*8 ;
junk = fseek(fid,ofs,-1) ;
[~] = fseek(fid,ofs,-1) ;
c = fread(fid,[jcf,ny],'float64')' ;
d1(ir) = c(:,jcf)-c(:,icf)*d1(irf) ;
......
......@@ -32,7 +32,7 @@ function varlist = check_list_of_variables(options_, M_, varlist)
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
% Get uniques
[junk1, junk2, index_uniques] = varlist_indices(varlist, M_.endo_names);
[~, ~, index_uniques] = varlist_indices(varlist, M_.endo_names);
varlist = varlist(index_uniques);
msg = false;
......
......@@ -387,7 +387,7 @@ if ~strcmp(posterior_sampler_options.posterior_sampling_method,'slice')
end
if options_.load_mh_file && posterior_sampler_options.use_mh_covariance_matrix
[junk, invhess] = compute_mh_covariance_matrix;
[~, invhess] = compute_mh_covariance_matrix;
posterior_sampler_options.invhess = invhess;
end
......@@ -409,7 +409,7 @@ if strcmp(posterior_sampler_options.posterior_sampling_method,'slice')
error('check_posterior_sampler_options:: This error should not occur, please contact developers.')
end
% % % if options_.load_mh_file && options_.use_mh_covariance_matrix,
% % % [junk, invhess] = compute_mh_covariance_matrix;
% % % [~, invhess] = compute_mh_covariance_matrix;
% % % posterior_sampler_options.invhess = invhess;
% % % end
[V1, D]=eig(invhess);
......
......@@ -63,7 +63,7 @@ end
%call steady_state_file if present to update parameters
if options_.steadystate_flag
% explicit steady state file
[junk,M_.params,info] = evaluate_steady_state_file(oo_.steady_state,[oo_.exo_steady_state; oo_.exo_det_steady_state],M_, ...
[~,M_.params,info] = evaluate_steady_state_file(oo_.steady_state,[oo_.exo_steady_state; oo_.exo_det_steady_state],M_, ...
options_,0);
end
[U,Uy,W] = feval([M_.fname,'.objective.static'],zeros(endo_nbr,1),[], M_.params);
......@@ -129,7 +129,7 @@ iter=1;
for j=1:numel(Indices)
eval(['A',Indices{j},'=zeros(eq_nbr,endo_nbr);'])
if strcmp(Indices{j},'0')||(strcmp(Indices{j},'lag') && MaxLag)||(strcmp(Indices{j},'lead') && MaxLead)
[junk,row,col]=find(lead_lag_incidence(iter,:));
[~,row,col]=find(lead_lag_incidence(iter,:));
eval(['A',Indices{j},'(:,row)=jacobia_(:,col);'])
iter=iter+1;
end
......
......@@ -409,7 +409,7 @@ for i = 1:Size
index_c = lead_lag_incidence(2,:); % Index of all endogenous variables present at time=t
index_s = lead_lag_incidence(2,1:n_static); % Index of all static endogenous variables present at time=t
if n_static > 0
[Q, junk] = qr(jacob(:,index_s));
[Q, ~] = qr(jacob(:,index_s));
aa = Q'*jacob;
else
aa = jacob;
......@@ -476,7 +476,7 @@ for i = 1:Size
if isfield(options_,'indeterminacy_continuity')
if options_.indeterminacy_msv == 1
[ss,tt,w,q] = qz(E',D');
[ss,tt,w,junk] = reorder(ss,tt,w,q);
[ss,tt,w,~] = reorder(ss,tt,w,q);
ss = ss';
tt = tt';
w = w';
......
......@@ -111,7 +111,7 @@ switch pshape(indx)
end
if pshape(indx) ~= 5
[junk,k1] = max(dens);
[~,k1] = max(dens);
if k1 == 1 || k1 == length(dens)
k = find(dens > 10);
dens(k) = NaN;
......
......@@ -124,7 +124,7 @@ if isempty(reorder_jacobian_columns)
nsfwrd)))];
index_e2 = npred+nboth+(1:nboth);
[junk,cols_b] = find(lead_lag_incidence(maximum_lag+1, order_var));
[~,cols_b] = find(lead_lag_incidence(maximum_lag+1, order_var));
reorder_jacobian_columns = [nonzeros(lead_lag_incidence(:,order_var)'); ...
nz+(1:exo_nbr)'];
......@@ -138,7 +138,7 @@ dr.state_var = state_var;
jacobia = jacobia(:,reorder_jacobian_columns);
if nstatic > 0
[Q, junk] = qr(jacobia(:,index_s));
[Q, ~] = qr(jacobia(:,index_s));
aa = Q'*jacobia;
else
aa = jacobia;
......
......@@ -75,7 +75,7 @@ elseif options_.steadystate_flag
ys_init(k_inst) = inst_val;
exo_ss = [oo.exo_steady_state oo.exo_det_steady_state];
[xx,params] = evaluate_steady_state_file(ys_init,exo_ss,M,options_,~options_.steadystate.nocheck); %run steady state file again to update parameters
[junk,junk,steady_state] = nl_func(inst_val); %compute and return steady state
[~,~,steady_state] = nl_func(inst_val); %compute and return steady state
else
n_var = M.orig_endo_nbr;
xx = oo.steady_state(1:n_var);
......@@ -85,7 +85,7 @@ else
if info1~=0
check=81;
end
[junk,junk,steady_state] = nl_func(xx);
[~,~,steady_state] = nl_func(xx);
end
......@@ -194,8 +194,8 @@ end
function result = check_static_model(ys,M,options_,oo)
result = false;
if (options_.bytecode)
[chck, res, junk] = bytecode('static',ys,[oo.exo_steady_state oo.exo_det_steady_state], ...
M.params, 'evaluate');
[chck, res, ~] = bytecode('static',ys,[oo.exo_steady_state oo.exo_det_steady_state], ...
M.params, 'evaluate');
else
res = feval([M.fname '.static'],ys,[oo.exo_steady_state oo.exo_det_steady_state], ...
M.params);
......
......@@ -88,7 +88,7 @@ exo_nbr = M.exo_nbr;
M.var_order_endo_names = M.endo_names(dr.order_var);
[junk,dr.i_fwrd_g,i_fwrd_f] = find(lead_lag_incidence(3,order_var));
[~,dr.i_fwrd_g,i_fwrd_f] = find(lead_lag_incidence(3,order_var));
dr.i_fwrd_f = i_fwrd_f;
nd = nnz(lead_lag_incidence) + M.exo_nbr;
dr.nd = nd;
......
......@@ -105,7 +105,7 @@ k1 = find(kstate(:,2) == M_.maximum_endo_lag+2);
% Jacobian with respect to the variables with the highest lead
fyp = jacobia(:,kstate(k1,3)+nnz(M_.lead_lag_incidence(M_.maximum_endo_lag+1,:)));
B(:,nstatic+M_.npred+1:end) = fyp;
[junk,k1,k2] = find(M_.lead_lag_incidence(M_.maximum_endo_lag+M_.maximum_endo_lead+1,order_var));
[~,k1,k2] = find(M_.lead_lag_incidence(M_.maximum_endo_lag+M_.maximum_endo_lead+1,order_var));
A(1:M_.endo_nbr,nstatic+1:nstatic+nspred)=...
A(1:M_.endo_nbr,nstatic+[1:nspred])+fyp*gx1(k1,1:nspred);
C = Gy;
......@@ -162,7 +162,7 @@ kp = sum(kstate(:,2) <= M_.maximum_endo_lag+1);
E1 = [eye(nspred); zeros(kp-nspred,nspred)];
H = E1;
hxx = dr.ghxx(nstatic+[1:nspred],:);
[junk,k2a,k2] = find(M_.lead_lag_incidence(M_.maximum_endo_lag+2,order_var));
[~,k2a,k2] = find(M_.lead_lag_incidence(M_.maximum_endo_lag+2,order_var));
k3 = nnz(M_.lead_lag_incidence(1:M_.maximum_endo_lag+1,:))+(1:M_.nsfwrd)';
[B1, err] = sparse_hessian_times_B_kronecker_C(hessian_mat(:,kh(k3,k3)),gu(k2a,:),threads_BC);
mexErrCheck('sparse_hessian_times_B_kronecker_C', err);
......
......@@ -191,7 +191,7 @@ end
if ispc
arch = getenv('PROCESSOR_ARCHITECTURE');
else
[junk, arch] = system('uname -m');
[~, arch] = system('uname -m');
end
if isempty(strfind(arch, '64'))
......
......@@ -235,8 +235,8 @@ if ~isequal(options_.mode_compute,0) && ~options_.mh_posterior_mode_estimation
if options_.analytic_derivation && strcmp(func2str(objective_function),'dsge_likelihood')
ana_deriv_old = options_.analytic_derivation;
options_.analytic_derivation = 2;
[junk1, junk2,junk3, junk4, hh] = feval(objective_function,xparam1, ...
dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,bounds,oo_);
[~,~,~,~,hh] = feval(objective_function,xparam1, ...
dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,bounds,oo_);
options_.analytic_derivation = ana_deriv_old;
elseif ~isnumeric(options_.mode_compute) || ~(isequal(options_.mode_compute,5) && newratflag~=1 && strcmp(func2str(objective_function),'dsge_likelihood'))
% with flag==0, we force to use the hessian from outer product gradient of optimizer 5
......@@ -373,9 +373,8 @@ if any(bayestopt_.pshape > 0) && ~options_.mh_posterior_mode_estimation
skipline()
end
if options_.dsge_var
[junk1,junk2,junk3,junk4,junk5,junk6,junk7,oo_.dsge_var.posterior_mode.PHI_tilde,oo_.dsge_var.posterior_mode.SIGMA_u_tilde,oo_.dsge_var.posterior_mode.iXX,oo_.dsge_var.posterior_mode.prior] =...
[~,~,~,~,~,~,~,oo_.dsge_var.posterior_mode.PHI_tilde,oo_.dsge_var.posterior_mode.SIGMA_u_tilde,oo_.dsge_var.posterior_mode.iXX,oo_.dsge_var.posterior_mode.prior] =...
feval(objective_function,xparam1,dataset_,dataset_info,options_,M_,estim_params_,bayestopt_,bounds,oo_);
clear('junk1','junk2','junk3','junk4','junk5','junk6','junk7');
end
elseif ~any(bayestopt_.pshape > 0) && ~options_.mh_posterior_mode_estimation
......@@ -519,7 +518,7 @@ if (any(bayestopt_.pshape >0 ) && options_.mh_replic) || ...
oo_.posterior.metropolis=oo_load_mh.oo_.posterior.metropolis;
end
end
[error_flag,junk,options_]= metropolis_draw(1,options_,estim_params_,M_);
[error_flag,~,options_]= metropolis_draw(1,options_,estim_params_,M_);
if options_.bayesian_irf
if error_flag
error('Estimation::mcmc: I cannot compute the posterior IRFs!')
......
......@@ -454,38 +454,38 @@ if options_.block == 1
% Set restrict_state to postion of observed + state variables in expanded state vector.
oo_.dr.restrict_var_list = [k1(i_posA) M_.state_var(sort(i_posB))];
% set mf0 to positions of state variables in restricted state vector for likelihood computation.
[junk,bayestopt_.mf0] = ismember(M_.state_var',oo_.dr.restrict_var_list);
[~,bayestopt_.mf0] = ismember(M_.state_var',oo_.dr.restrict_var_list);
% Set mf1 to positions of observed variables in restricted state vector for likelihood computation.
[junk,bayestopt_.mf1] = ismember(k1,oo_.dr.restrict_var_list);
[~,bayestopt_.mf1] = ismember(k1,oo_.dr.restrict_var_list);
% Set mf2 to positions of observed variables in expanded state vector for filtering and smoothing.
bayestopt_.mf2 = var_obs_index_dr;
bayestopt_.mfys = k1;
oo_.dr.restrict_columns = [size(i_posA,1)+(1:size(M_.state_var,2))];
[k2, i_posA, i_posB] = union(k3p, M_.state_var', 'rows');
bayestopt_.smoother_var_list = [k3p(i_posA); M_.state_var(sort(i_posB))'];
[junk,junk,bayestopt_.smoother_saved_var_list] = intersect(k3p,bayestopt_.smoother_var_list(:));
[junk,ic] = intersect(bayestopt_.smoother_var_list,M_.state_var);
[~,~,bayestopt_.smoother_saved_var_list] = intersect(k3p,bayestopt_.smoother_var_list(:));
[~,ic] = intersect(bayestopt_.smoother_var_list,M_.state_var);
bayestopt_.smoother_restrict_columns = ic;
[junk,bayestopt_.smoother_mf] = ismember(k1, bayestopt_.smoother_var_list);
[~,bayestopt_.smoother_mf] = ismember(k1, bayestopt_.smoother_var_list);
else
% Define union of observed and state variables
k2 = union(var_obs_index_dr,[M_.nstatic+1:M_.nstatic+M_.nspred]', 'rows');
% Set restrict_state to postion of observed + state variables in expanded state vector.
oo_.dr.restrict_var_list = k2;
% set mf0 to positions of state variables in restricted state vector for likelihood computation.
[junk,bayestopt_.mf0] = ismember([M_.nstatic+1:M_.nstatic+M_.nspred]',k2);
[~,bayestopt_.mf0] = ismember([M_.nstatic+1:M_.nstatic+M_.nspred]',k2);
% Set mf1 to positions of observed variables in restricted state vector for likelihood computation.
[junk,bayestopt_.mf1] = ismember(var_obs_index_dr,k2);
[~,bayestopt_.mf1] = ismember(var_obs_index_dr,k2);
% Set mf2 to positions of observed variables in expanded state vector for filtering and smoothing.
bayestopt_.mf2 = var_obs_index_dr;
bayestopt_.mfys = k1;
[junk,ic] = intersect(k2,nstatic+(1:npred)');
[~,ic] = intersect(k2,nstatic+(1:npred)');
oo_.dr.restrict_columns = [ic; length(k2)+(1:nspred-npred)'];
bayestopt_.smoother_var_list = union(k2,k3);
[junk,junk,bayestopt_.smoother_saved_var_list] = intersect(k3,bayestopt_.smoother_var_list(:));
[junk,ic] = intersect(bayestopt_.smoother_var_list,nstatic+(1:npred)');
[~,~,bayestopt_.smoother_saved_var_list] = intersect(k3,bayestopt_.smoother_var_list(:));
[~,ic] = intersect(bayestopt_.smoother_var_list,nstatic+(1:npred)');
bayestopt_.smoother_restrict_columns = ic;
[junk,bayestopt_.smoother_mf] = ismember(var_obs_index_dr, bayestopt_.smoother_var_list);
[~,bayestopt_.smoother_mf] = ismember(var_obs_index_dr, bayestopt_.smoother_var_list);
end
if options_.analytic_derivation
......
......@@ -52,11 +52,11 @@ for i=1:m
else
h = H(:,i);
end
[Fh,junk1,junk2,flag] = feval(fcn, x+transpose(h), varargin{:});
[Fh,~,~,flag] = feval(fcn, x+transpose(h), varargin{:});
if flag
G(:,i) = (Fh-F)/epsilon;
else
[Fh,junk1,junk2,flag] = feval(fcn, x-transpose(h), varargin{:});
[Fh,~,~,flag] = feval(fcn, x-transpose(h), varargin{:});
if flag
G(:,i) = (F-Fh)/epsilon;
else
......
......@@ -307,7 +307,7 @@ if M.static_and_dynamic_models_differ
z = repmat(ys,1,M.maximum_lead + M.maximum_lag + 1);
zx = repmat([exo_ss'], M.maximum_lead + M.maximum_lag + 1, 1);
if options.bytecode
[chck, r, junk]= bytecode('dynamic','evaluate', z, zx, M.params, ys, 1);
[chck, r, ~]= bytecode('dynamic','evaluate', z, zx, M.params, ys, 1);
mexErrCheck('bytecode', chck);
elseif options.block
[r, oo.dr] = feval([M.fname '.dynamic'], z', zx, M.params, ys, M.maximum_lag+1, oo.dr);
......
......@@ -55,7 +55,7 @@ if strcmpi(type,'posterior')
CutSample(M_, options_, estim_params_);
%% initialize metropolis draws
options_.sub_draws=n_draws; %set draws for sampling; changed value is not returned to base workspace
[error_flag,junk,options_]= metropolis_draw(1,options_,estim_params_,M_);
[error_flag,~,options_]= metropolis_draw(1,options_,estim_params_,M_);
if error_flag
error('EXECUTE_POSTERIOR_FUNCTION: The draws could not be initialized')
end
......
......@@ -319,8 +319,8 @@ if nargout > 5
end
end
[junk,cols_b,cols_j] = find(M_.lead_lag_incidence(M_.maximum_endo_lag+1, ...
oo_.dr.order_var));
[~,cols_b,cols_j] = find(M_.lead_lag_incidence(M_.maximum_endo_lag+1, ...
oo_.dr.order_var));
GAM0 = zeros(M_.endo_nbr,M_.endo_nbr);
Dg0 = zeros(M_.endo_nbr,M_.endo_nbr,param_nbr);
GAM0(:,cols_b) = g1(:,cols_j);
......
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