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
|
elseif options_.lik_init == 3 % Diffuse Kalman filter
|
||||||
kalman_algo = 3;
|
kalman_algo = 3;
|
||||||
[QT,ST] = schur(T);
|
[QT,ST] = schur(T);
|
||||||
|
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;
|
e1 = abs(ordeig(ST)) > 2-options_.qz_criterium;
|
||||||
|
end
|
||||||
[QT,ST] = ordschur(QT,ST,e1);
|
[QT,ST] = ordschur(QT,ST,e1);
|
||||||
|
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);
|
k = find(abs(ordeig(ST)) > 2-options_.qz_criterium);
|
||||||
|
end
|
||||||
nk = length(k);
|
nk = length(k);
|
||||||
nk1 = nk+1;
|
nk1 = nk+1;
|
||||||
Pinf = zeros(np,np);
|
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
|
elseif options_.lik_init == 3 % Diffuse Kalman filter
|
||||||
kalman_algo = 3;
|
kalman_algo = 3;
|
||||||
[QT,ST] = schur(T);
|
[QT,ST] = schur(T);
|
||||||
|
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;
|
e1 = abs(ordeig(ST)) > 2-options_.qz_criterium;
|
||||||
|
end
|
||||||
[QT,ST] = ordschur(QT,ST,e1);
|
[QT,ST] = ordschur(QT,ST,e1);
|
||||||
|
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);
|
k = find(abs(ordeig(ST)) > 2-options_.qz_criterium);
|
||||||
|
end
|
||||||
nk = length(k);
|
nk = length(k);
|
||||||
nk1 = nk+1;
|
nk1 = nk+1;
|
||||||
Pinf = zeros(np,np);
|
Pinf = zeros(np,np);
|
||||||
|
|
|
@ -16,7 +16,7 @@ function [x,u]=lyapunov_symm(a,b,qz_criterium)
|
||||||
% uses reordered Schur decomposition
|
% uses reordered Schur decomposition
|
||||||
%
|
%
|
||||||
% SPECIAL REQUIREMENTS
|
% 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)
|
% part of DYNARE, copyright Dynare Team (2006-2008)
|
||||||
% Gnu Public License
|
% Gnu Public License
|
||||||
|
@ -30,10 +30,10 @@ function [x,u]=lyapunov_symm(a,b,qz_criterium)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
[u,t] = schur(a);
|
[u,t] = schur(a);
|
||||||
if exist('ordeig','builtin')
|
if exist('OCTAVE_VERSION') || matlab_ver_less_than('7.0.1')
|
||||||
e1 = abs(ordeig(t)) > 2-qz_criterium;
|
|
||||||
else
|
|
||||||
e1 = abs(my_ordeig(t)) > 2-qz_criterium;
|
e1 = abs(my_ordeig(t)) > 2-qz_criterium;
|
||||||
|
else
|
||||||
|
e1 = abs(ordeig(t)) > 2-qz_criterium;
|
||||||
end
|
end
|
||||||
k = sum(e1);
|
k = sum(e1);
|
||||||
if exist('ordschur','builtin')
|
if exist('ordschur','builtin')
|
||||||
|
|
|
@ -23,10 +23,10 @@ function eigs = my_ordeig(t)
|
||||||
break;
|
break;
|
||||||
elseif t(i+1,i) == 0
|
elseif t(i+1,i) == 0
|
||||||
eigs(i) = t(i,i);
|
eigs(i) = t(i,i);
|
||||||
|
i = i+1;
|
||||||
else
|
else
|
||||||
k = i:i+1;
|
k = i:i+1;
|
||||||
eigs(k) = eig(t(k,k));
|
eigs(k) = eig(t(k,k));
|
||||||
i = i+1;
|
i = i+2;
|
||||||
end
|
end
|
||||||
i = i+1;
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue