Merge pull request #497 from JohannesPfeifer/get_IRF_shocks_unique

Filter out shocks specified twice for IRF generation
time-shift
Sébastien Villemot 2013-10-15 03:54:02 -07:00
commit 025f0d5bf8
1 changed files with 16 additions and 2 deletions

View File

@ -1,6 +1,14 @@
function irf_shocks_indx=getIrfShocksIndx()
% Copyright (C) 2011 Dynare Team
% irf_shocks_indx=getIrfShocksIndx()
% returns the unique indices of the exogenous shocks specified for IRF
% generation using the irf_shocks-command
%
% Inputs:
% none
% Outputs:
% irf_shocks_indx: [1 by n_irf_shocks] vector storing the indices
%
% Copyright (C) 2011-13 Dynare Team
%
% This file is part of Dynare.
%
@ -26,4 +34,10 @@ else
for i=1:size(options_.irf_shocks,1)
irf_shocks_indx(i) = find(strcmp(deblank(options_.irf_shocks(i,:)), cellstr(M_.exo_names)));
end
irf_shocks_indx_unique=unique(irf_shocks_indx);
if options_.debug && (length(irf_shocks_indx_unique) ~= length(irf_shocks_indx))
fprintf('\nSTOCH_SIMUL: Warning: The IRFs for some shocks have been requested twice.\n')
fprintf('STOCH_SIMUL: The redundant entries will be ignored.\n')
end
irf_shocks_indx=irf_shocks_indx_unique;
end