Commit b66a47c1 authored by ratto's avatar ratto
Browse files

oo_, A and B are now inherited from main loop

git-svn-id: https://www.dynare.org/svn/dynare/trunk@2980 ac1d8469-bf42-47a9-8791-bf33cf982152
parent 5d52ded3
function [H, A0, B0, dA, dOm, info] = getH(M_,oo_,kronflag,indx,indexo)
function [H, dA, dOm, info] = getH(A, B, M_,oo_,kronflag,indx,indexo)
% computes derivative of reduced form linear model w.r.t. deep params
%
......@@ -62,15 +62,15 @@ param_nbr = length(indx);
% order_var = [oo_.dr.order_var; ...
% [size(oo_dr.ghx,2)+1:size(oo_dr.ghx,2)+size(oo_.dr.transition_auxiliary_variables,1)]' ];
% [A(order_var,order_var),B(order_var,:)]=dynare_resolve;
[A,B,ys,info]=dynare_resolve;
if info(1) > 0
H = [];
A0 = [];
B0 = [];
dA = [];
dOm = [];
return
end
% [A,B,ys,info]=dynare_resolve;
% if info(1) > 0
% H = [];
% A0 = [];
% B0 = [];
% dA = [];
% dOm = [];
% return
% end
m = size(A,1);
n = size(B,2);
......@@ -277,7 +277,7 @@ else % generalized sylvester equation
y = B*dSig*B';
y = y(nauxe+1:end,nauxe+1:end);
H(:,j) = [zeros((m-nauxe)^2,1); vech(y)];
if nargout>3,
if nargout>1,
dOm(:,:,j) = y;
end
dSig(indexo(j),indexo(j)) = 0;
......@@ -289,7 +289,7 @@ else % generalized sylvester equation
y = y*M_.Sigma_e*B'+B*M_.Sigma_e*y';
x = x(nauxe+1:end,nauxe+1:end);
y = y(nauxe+1:end,nauxe+1:end);
if nargout>3,
if nargout>1,
dA(:,:,j+length(indexo)) = x;
dOm(:,:,j+length(indexo)) = y;
end
......
function [JJ, H, A, B, GAM] = getJJ(M_,oo_,options_,kronflag,indx,indexo,mf,nlags,useautocorr)
function [JJ, H, gam] = getJJ(A, B, M_,oo_,options_,kronflag,indx,indexo,mf,nlags,useautocorr)
% Copyright (C) 2009 Dynare Team
%
......@@ -17,10 +17,10 @@ function [JJ, H, A, B, GAM] = getJJ(M_,oo_,options_,kronflag,indx,indexo,mf,nlag
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if nargin<5 | isempty(indx), indx = [1:M_.param_nbr];, end,
if nargin<6 | isempty(indexo), indexo = [];, end,
if nargin<8 | isempty(nlags), nlags=3; end,
if nargin<9 | isempty(useautocorr), useautocorr=0; end,
if nargin<7 | isempty(indx), indx = [1:M_.param_nbr];, end,
if nargin<8 | isempty(indexo), indexo = [];, end,
if nargin<10 | isempty(nlags), nlags=3; end,
if nargin<11 | isempty(useautocorr), useautocorr=0; end,
if useautocorr,
warning('off','MATLAB:divideByZero')
......@@ -33,12 +33,12 @@ if kronflag == -1,
assignin('base','M_', M_);
assignin('base','oo_', oo_);
else
[H, A, B, dA, dOm, info] = getH(M_,oo_,kronflag,indx,indexo);
if info(1) > 0
JJ = [];
GAM = [];
return
end
[H, dA, dOm] = getH(A, B, M_,oo_,kronflag,indx,indexo);
% if isempty(H),
% JJ = [];
% GAM = [];
% return
% end
m = length(A);
GAM = lyapunov_symm(A,B*M_.Sigma_e*B',options_.qz_criterium,options_.lyapunov_complex_threshold,1);
......@@ -107,8 +107,16 @@ else
JJ(:,j+nexo) = dumm;
end
if nargout >4,
if nargout >2,
sy=sy(mf,mf);
sy=sy-diag(diag(sy))+eye(length(mf));
options_.ar=nlags;
[GAM,stationary_vars] = th_autocovariances(oo_.dr,oo_.dr.order_var(mf),M_,options_);
GAM{1}=GAM{1}./sy;
gam = vech(GAM{1});
for j=1:nlags,
gam = [gam; vec(GAM{j+1})];
end
end
end
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment