v4 matlab: use my_ordeig instead of ordeig for Octave and for Matlab < 7.0.1
git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1938 ac1d8469-bf42-47a9-8791-bf33cf982152time-shift
parent
2d4d93df13
commit
e8d6dd1ef3
|
@ -163,9 +163,17 @@ function [fval,cost_flag,ys,trend_coeff,info] = DsgeLikelihood(xparam1,gend,data
|
|||
elseif options_.lik_init == 3 % Diffuse Kalman filter
|
||||
kalman_algo = 3;
|
||||
[QT,ST] = schur(T);
|
||||
e1 = abs(ordeig(ST)) > 2-options_.qz_criterium;
|
||||
if exist('OCTAVE_VERSION') || matlab_ver_less_than('7.0.1')
|
||||
e1 = abs(my_ordeig(ST)) > 2-options_.qz_criterium;
|
||||
else
|
||||
e1 = abs(ordeig(ST)) > 2-options_.qz_criterium;
|
||||
end
|
||||
[QT,ST] = ordschur(QT,ST,e1);
|
||||
k = find(abs(ordeig(ST)) > 2-options_.qz_criterium);
|
||||
if exist('OCTAVE_VERSION') || matlab_ver_less_than('7.0.1')
|
||||
k = find(abs(my_ordeig(ST)) > 2-options_.qz_criterium);
|
||||
else
|
||||
k = find(abs(ordeig(ST)) > 2-options_.qz_criterium);
|
||||
end
|
||||
nk = length(k);
|
||||
nk1 = nk+1;
|
||||
Pinf = zeros(np,np);
|
||||
|
|
|
@ -104,9 +104,17 @@ function [alphahat,etahat,epsilonhat,ahat,SteadyState,trend_coeff,aK,T,R,P,PK,d,
|
|||
elseif options_.lik_init == 3 % Diffuse Kalman filter
|
||||
kalman_algo = 3;
|
||||
[QT,ST] = schur(T);
|
||||
e1 = abs(ordeig(ST)) > 2-options_.qz_criterium;
|
||||
if exist('OCTAVE_VERSION') || matlab_ver_less_than('7.0.1')
|
||||
e1 = abs(my_ordeig(ST)) > 2-options_.qz_criterium;
|
||||
else
|
||||
e1 = abs(ordeig(ST)) > 2-options_.qz_criterium;
|
||||
end
|
||||
[QT,ST] = ordschur(QT,ST,e1);
|
||||
k = find(abs(ordeig(ST)) > 2-options_.qz_criterium);
|
||||
if exist('OCTAVE_VERSION') || matlab_ver_less_than('7.0.1')
|
||||
k = find(abs(my_ordeig(ST)) > 2-options_.qz_criterium);
|
||||
else
|
||||
k = find(abs(ordeig(ST)) > 2-options_.qz_criterium);
|
||||
end
|
||||
nk = length(k);
|
||||
nk1 = nk+1;
|
||||
Pinf = zeros(np,np);
|
||||
|
|
|
@ -16,7 +16,7 @@ function [x,u]=lyapunov_symm(a,b,qz_criterium)
|
|||
% uses reordered Schur decomposition
|
||||
%
|
||||
% SPECIAL REQUIREMENTS
|
||||
% needs Matlab version with ordeig function
|
||||
% needs Matlab >= 7.0.1 for ordeig function (otherwise uses my_ordeig)
|
||||
%
|
||||
% part of DYNARE, copyright Dynare Team (2006-2008)
|
||||
% Gnu Public License
|
||||
|
@ -30,10 +30,10 @@ function [x,u]=lyapunov_symm(a,b,qz_criterium)
|
|||
return
|
||||
end
|
||||
[u,t] = schur(a);
|
||||
if exist('ordeig','builtin')
|
||||
e1 = abs(ordeig(t)) > 2-qz_criterium;
|
||||
else
|
||||
if exist('OCTAVE_VERSION') || matlab_ver_less_than('7.0.1')
|
||||
e1 = abs(my_ordeig(t)) > 2-qz_criterium;
|
||||
else
|
||||
e1 = abs(ordeig(t)) > 2-qz_criterium;
|
||||
end
|
||||
k = sum(e1);
|
||||
if exist('ordschur','builtin')
|
||||
|
|
|
@ -23,10 +23,10 @@ function eigs = my_ordeig(t)
|
|||
break;
|
||||
elseif t(i+1,i) == 0
|
||||
eigs(i) = t(i,i);
|
||||
i = i+1;
|
||||
else
|
||||
k = i:i+1;
|
||||
eigs(k) = eig(t(k,k));
|
||||
i = i+1;
|
||||
i = i+2;
|
||||
end
|
||||
i = i+1;
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue