1function [eigenvalues_,result,info] = check(M, options, oo) 2 3% Checks determinacy conditions by computing the generalized eigenvalues. 4% 5% INPUTS 6% - M [structure] Matlab's structure describing the model (M_). 7% - options [structure] Matlab's structure describing the current options (options_). 8% - oo [structure] Matlab's structure containing the results (oo_). 9% 10% OUTPUTS 11% - eigenvalues_ [double] vector, eigenvalues. 12% - result [integer] scalar, equal to 1 if Blanchard and Kahn conditions are satisfied, zero otherwise. 13% - info [integer] scalar or vector, error code as returned by resol routine. 14 15% Copyright (C) 2001-2019 Dynare Team 16% 17% This file is part of Dynare. 18% 19% Dynare is free software: you can redistribute it and/or modify 20% it under the terms of the GNU General Public License as published by 21% the Free Software Foundation, either version 3 of the License, or 22% (at your option) any later version. 23% 24% Dynare is distributed in the hope that it will be useful, 25% but WITHOUT ANY WARRANTY; without even the implied warranty of 26% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27% GNU General Public License for more details. 28% 29% You should have received a copy of the GNU General Public License 30% along with Dynare. If not, see <http://www.gnu.org/licenses/>. 31 32 33if ~options.initval_file && M.exo_nbr > 1 34 oo.exo_simul = ones(M.maximum_lead+M.maximum_lag+1,1)*oo.exo_steady_state'; 35end 36 37options.order = 1; 38 39if isempty(options.qz_criterium) 40 options.qz_criterium = 1+1e-6; 41end 42 43oo.dr=set_state_space(oo.dr,M,options); 44 45[dr,info,M,options,~] = resol(1,M,options,oo); 46 47if info(1) ~= 0 && info(1) ~= 3 && info(1) ~= 4 48 print_info(info, 0, options); 49end 50 51eigenvalues_ = dr.eigval; 52[m_lambda,i]=sort(abs(eigenvalues_)); 53 54% Count number of forward looking variables 55if ~options.block 56 nyf = M.nsfwrd; 57else 58 nyf = 0; 59 for j = 1:length(M.block_structure.block) 60 nyf = nyf + M.block_structure.block(j).n_forward + M.block_structure.block(j).n_mixed; 61 end 62end 63 64result = 0; 65if (nyf == dr.edim) && (dr.full_rank) 66 result = 1; 67end 68 69if ~options.noprint 70 skipline() 71 disp('EIGENVALUES:') 72 disp(sprintf('%16s %16s %16s\n','Modulus','Real','Imaginary')) 73 z=[m_lambda real(eigenvalues_(i)) imag(eigenvalues_(i))]'; 74 disp(sprintf('%16.4g %16.4g %16.4g\n',z)) 75 disp(sprintf('\nThere are %d eigenvalue(s) larger than 1 in modulus ', dr.edim)); 76 disp(sprintf('for %d forward-looking variable(s)',nyf)); 77 skipline() 78 if result 79 disp('The rank condition is verified.') 80 else 81 disp('The rank condition ISN''T verified!') 82 end 83 skipline() 84end 85