From 9ec22085b081c5860663ecc340b64b1a3001fdb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Tue, 11 Dec 2012 18:10:01 +0100 Subject: [PATCH] Fix wrong count of forward looking vars in check with block option Bug introduced in c121aa14b1f9147a13d6b3fee078b8a65ea2fb96 --- matlab/check.m | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/matlab/check.m b/matlab/check.m index c392996f3..2ff30e0af 100644 --- a/matlab/check.m +++ b/matlab/check.m @@ -80,10 +80,18 @@ eigenvalues_ = dr.eigval; [m_lambda,i]=sort(abs(eigenvalues_)); n_explod = nnz(abs(eigenvalues_) > options.qz_criterium); -nsfwrd = M.nsfwrd +% Count number of forward looking variables +if ~options.block + nyf = M.nsfwrd; +else + nyf = 0; + for j = 1:length(M.block_structure.block) + nyf = nyf + M.block_structure.block(j).n_forward + M.block_structure.block(j).n_mixed; + end +end result = 0; -if (nsfwrd == n_explod) && (dr.full_rank) +if (nyf == n_explod) && (dr.full_rank) result = 1; end @@ -94,7 +102,7 @@ if options.noprint == 0 z=[m_lambda real(eigenvalues_(i)) imag(eigenvalues_(i))]'; disp(sprintf('%16.4g %16.4g %16.4g\n',z)) disp(sprintf('\nThere are %d eigenvalue(s) larger than 1 in modulus ', n_explod)); - disp(sprintf('for %d forward-looking variable(s)',nsfwrd)); + disp(sprintf('for %d forward-looking variable(s)',nyf)); disp(' ') if result disp('The rank condition is verified.')