Removed Octave specific part in mjdgges.m function.
Also force complex QZ factorization in Octave.time-shift
parent
7f7cb3ea07
commit
ad21612967
|
@ -22,7 +22,7 @@ function [err,ss,tt,w,sdim,eigval,info] = mjdgges(e,d,qz_criterium, fake)
|
||||||
% SPECIAL REQUIREMENTS
|
% SPECIAL REQUIREMENTS
|
||||||
% none.
|
% none.
|
||||||
|
|
||||||
% Copyright (C) 1996-2010 Dynare Team
|
% Copyright (C) 1996-2017 Dynare Team
|
||||||
%
|
%
|
||||||
% This file is part of Dynare.
|
% This file is part of Dynare.
|
||||||
%
|
%
|
||||||
|
@ -43,6 +43,7 @@ function [err,ss,tt,w,sdim,eigval,info] = mjdgges(e,d,qz_criterium, fake)
|
||||||
if nargin>4 || nargin<2 || nargout>7 || nargout==0
|
if nargin>4 || nargin<2 || nargout>7 || nargout==0
|
||||||
error('MJDGGES: takes 2 or 3 input arguments and between 1 and 7 output arguments.')
|
error('MJDGGES: takes 2 or 3 input arguments and between 1 and 7 output arguments.')
|
||||||
end
|
end
|
||||||
|
|
||||||
% Check the first two inputs.
|
% Check the first two inputs.
|
||||||
[me,ne] = size(e);
|
[me,ne] = size(e);
|
||||||
[md,nd] = size(d);
|
[md,nd] = size(d);
|
||||||
|
@ -58,35 +59,29 @@ end
|
||||||
|
|
||||||
info = 0;
|
info = 0;
|
||||||
|
|
||||||
% qz() function doesn't behave the same way under Octave and MATLAB:
|
% Initialization of the output arguments.
|
||||||
% - under MATLAB, complex decomposition by default, real is also available
|
ss = zeros(ne,ne);
|
||||||
% as an option
|
tt = zeros(ne,ne);
|
||||||
% - under Octave, only real decomposition available, but grouping of
|
w = zeros(ne,ne);
|
||||||
% eigenvalues <= 1 is implemented as an option (criterium can't be changed)
|
sdim = 0;
|
||||||
if isoctave
|
eigval = zeros(ne,1);
|
||||||
[ss,tt,w,eigval] = qz(e,d,'S');
|
|
||||||
sdim = sum(abs(eigval) <= 1.0);
|
% Computational part.
|
||||||
if any(abs(eigval) > 1.0 & abs(eigval) <= qz_criterium)
|
try
|
||||||
warning('Some eigenvalues are > 1.0 but <= qz_criterium in modulus. They have nevertheless been considered as explosive, because of a limitation of Octave. To solve this, you should compile the MEX files for Octave.')
|
if isoctave()
|
||||||
end
|
% Force complex QZ factorization.
|
||||||
else
|
e = complex(e);
|
||||||
% Initialization of the output arguments.
|
d = complex(d);
|
||||||
ss = zeros(ne,ne);
|
|
||||||
tt = zeros(ne,ne);
|
|
||||||
w = zeros(ne,ne);
|
|
||||||
sdim = 0;
|
|
||||||
eigval = zeros(ne,1);
|
|
||||||
% Computational part.
|
|
||||||
try
|
|
||||||
[ss,tt,qq,w] = qz(e,d);
|
|
||||||
[tt,ss,qq,w] = qzdiv(qz_criterium,tt,ss,qq,w);
|
|
||||||
warning_old_state = warning;
|
|
||||||
warning off;
|
|
||||||
eigval = diag(ss)./diag(tt);
|
|
||||||
warning(warning_old_state);
|
|
||||||
sdim = sum(abs(eigval) < qz_criterium);
|
|
||||||
catch
|
|
||||||
info = 1;% Not as precise as lapack's info!
|
|
||||||
end
|
end
|
||||||
|
[ss,tt,qq,w,a,b,c] = qz(e, d);
|
||||||
|
[tt,ss,qq,w] = qzdiv(qz_criterium, tt, ss, qq, w);
|
||||||
|
warning_old_state = warning;
|
||||||
|
warning off;
|
||||||
|
eigval = diag(ss)./diag(tt);
|
||||||
|
warning(warning_old_state);
|
||||||
|
sdim = sum(abs(eigval) < qz_criterium);
|
||||||
|
catch
|
||||||
|
info = 1;% Not as precise as lapack's info!
|
||||||
end
|
end
|
||||||
|
|
||||||
err = 0;
|
err = 0;
|
Loading…
Reference in New Issue