Home > matlab > check.m

check

PURPOSE ^

Checks determinacy conditions by computing the generalized eigenvalues.

SYNOPSIS ^

function [result,info] = check(M, options, oo)

DESCRIPTION ^

 Checks determinacy conditions by computing the generalized eigenvalues.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [result,info] = check(M, options, oo)
0002 % Checks determinacy conditions by computing the generalized eigenvalues.
0003 
0004 %@info:
0005 %! @deftypefn {Function File} {[result,info] =} check (@var{M},@var{options},@var{oo})
0006 %! @anchor{check}
0007 %! @sp 1
0008 %! Checks determinacy conditions by computing the generalized eigenvalues.
0009 %! @sp 2
0010 %! @strong{Inputs}
0011 %! @sp 1
0012 %! @table @ @var
0013 %! @item M
0014 %! Matlab's structure describing the model (initialized by dynare).
0015 %! @item options
0016 %! Matlab's structure describing the options (initialized by dynare).
0017 %! @item oo
0018 %! Matlab's structure gathering the results (initialized by dynare).
0019 %! @end table
0020 %! @sp 2
0021 %! @strong{Outputs}
0022 %! @sp 1
0023 %! @table @ @var
0024 %! @item result
0025 %! Integer scalar equal to one (BK conditions are satisfied) or zero (otherwise).
0026 %! @item info
0027 %! Integer scalar, error code as returned by @ref{resol}.
0028 %! @end table
0029 %! @sp 2
0030 %! @strong{This function is called by:}
0031 %! @sp 1
0032 %! @ref{smm_objective}
0033 %! @sp 2
0034 %! @strong{This function calls:}
0035 %! @sp 1
0036 %! @ref{resol}
0037 %! None.
0038 %! @end deftypefn
0039 %@eod:
0040 
0041 % Copyright (C) 2001-2011 Dynare Team
0042 %
0043 % This file is part of Dynare.
0044 %
0045 % Dynare is free software: you can redistribute it and/or modify
0046 % it under the terms of the GNU General Public License as published by
0047 % the Free Software Foundation, either version 3 of the License, or
0048 % (at your option) any later version.
0049 %
0050 % Dynare is distributed in the hope that it will be useful,
0051 % but WITHOUT ANY WARRANTY; without even the implied warranty of
0052 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0053 % GNU General Public License for more details.
0054 %
0055 % You should have received a copy of the GNU General Public License
0056 % along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
0057 
0058 
0059 if ~options.initval_file && M.exo_nbr > 1
0060     oo.exo_simul = ones(M.maximum_lead+M.maximum_lag+1,1)*oo.exo_steady_state';
0061 end
0062 
0063 options.order = 1;
0064 
0065 if isempty(options.qz_criterium)
0066     options.qz_criterium = 1+1e-6;
0067 end
0068 
0069 oo.dr=set_state_space(oo.dr,M);
0070 
0071 [dr,info,M,options,oo] = resol(1,M,options,oo);
0072 
0073 oo.dr = dr;
0074 
0075 if info(1) ~= 0 && info(1) ~= 3 && info(1) ~= 4
0076     print_info(info, options.noprint);
0077 end
0078 
0079 eigenvalues_ = dr.eigval;
0080 if (options.block)
0081     nyf = dr.nyf;
0082 else
0083     nyf = nnz(dr.kstate(:,2)>M.maximum_endo_lag+1);
0084 end;
0085 [m_lambda,i]=sort(abs(eigenvalues_));
0086 n_explod = nnz(abs(eigenvalues_) > options.qz_criterium);
0087 
0088 result = 0;
0089 if (nyf== n_explod) && (dr.rank == nyf)
0090     result = 1;
0091 end
0092 
0093 if options.noprint == 0
0094     disp(' ')
0095     disp('EIGENVALUES:')
0096     disp(sprintf('%16s %16s %16s\n','Modulus','Real','Imaginary'))
0097     z=[m_lambda real(eigenvalues_(i)) imag(eigenvalues_(i))]';
0098     disp(sprintf('%16.4g %16.4g %16.4g\n',z))
0099     disp(sprintf('\nThere are %d eigenvalue(s) larger than 1 in modulus ', n_explod));
0100     disp(sprintf('for %d forward-looking variable(s)',nyf));
0101     disp(' ')
0102     if dr.rank == nyf && nyf == n_explod
0103         disp('The rank condition is verified.')
0104     else
0105         disp('The rank conditions ISN''T verified!')
0106     end
0107     disp(' ')
0108 end

Generated on Mon 21-May-2012 02:42:43 by m2html © 2005