minor changes to new functions and completing headers
parent
10c6978369
commit
30d815afdc
|
@ -1,4 +1,67 @@
|
|||
function [dr,info] = dyn_first_order_solver(jacobia,b,M_,dr,options,task)
|
||||
function [dr,info] = dyn_first_order_solver(jacobia,M_,dr,options,task)
|
||||
|
||||
%@info:
|
||||
%! @deftypefn {Function File} {[@var{dr},@var{info}] =} dyn_first_order_solver (@var{jacobia},@var{M_},@var{dr},@var{options},@var{task})
|
||||
%! @anchor{dyn_first_order_solver}
|
||||
%! @sp 1
|
||||
%! Computes the first order reduced form of the DSGE model
|
||||
%! @sp 2
|
||||
%! @strong{Inputs}
|
||||
%! @sp 1
|
||||
%! @table @ @var
|
||||
%! @item jacobia
|
||||
%! Matrix containing the Jacobian of the model
|
||||
%! @item M_
|
||||
%! Matlab's structure describing the model (initialized by @code{dynare}).
|
||||
%! @item dr
|
||||
%! Matlab's structure describing the reduced form solution of the model.
|
||||
%! @item qz_criterium
|
||||
%! Double containing the criterium to separate explosive from stable eigenvalues
|
||||
%! @end table
|
||||
%! @sp 2
|
||||
%! @strong{Outputs}
|
||||
%! @sp 1
|
||||
%! @table @ @var
|
||||
%! @item dr
|
||||
%! Matlab's structure describing the reduced form solution of the model.
|
||||
%! @item info
|
||||
%! Integer scalar, error code.
|
||||
%! @sp 1
|
||||
%! @table @ @code
|
||||
%! @item info==0
|
||||
%! No error.
|
||||
%! @item info==1
|
||||
%! The model doesn't determine the current variables uniquely.
|
||||
%! @item info==2
|
||||
%! MJDGGES returned an error code.
|
||||
%! @item info==3
|
||||
%! Blanchard & Kahn conditions are not satisfied: no stable equilibrium.
|
||||
%! @item info==4
|
||||
%! Blanchard & Kahn conditions are not satisfied: indeterminacy.
|
||||
%! @item info==5
|
||||
%! Blanchard & Kahn conditions are not satisfied: indeterminacy due to rank failure.
|
||||
%! @item info==7
|
||||
%! One of the generalized eigenvalues is close to 0/0
|
||||
%! @end table
|
||||
%! @end deftypefn
|
||||
%@eod:
|
||||
|
||||
% Copyright (C) 2001-2011 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
% Dynare is free software: you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation, either version 3 of the License, or
|
||||
% (at your option) any later version.
|
||||
%
|
||||
% Dynare is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
info = 0;
|
||||
|
||||
|
@ -24,7 +87,7 @@ function [dr,info] = dyn_first_order_solver(jacobia,b,M_,dr,options,task)
|
|||
order_var));
|
||||
|
||||
if nstatic > 0
|
||||
[Q,R] = qr(b(:,1:nstatic));
|
||||
[Q,R] = qr(jacobia(:,cols_j(1:nstatic)));
|
||||
aa = Q'*jacobia;
|
||||
else
|
||||
aa = jacobia;
|
||||
|
|
|
@ -1,6 +1,54 @@
|
|||
function dr = dyn_second_order_solver(jacobia,hessian1,dr,M_,threads_ABC,threads_BC)
|
||||
function dr = dyn_second_order_solver(jacobia,hessian,dr,M_,threads_ABC,threads_BC)
|
||||
|
||||
%@info:
|
||||
%! @deftypefn {Function File} {@var{dr} =} dyn_second_order_solver (@var{jacobia},@var{hessian},@var{dr},@var{M_},@var{threads_ABC},@var{threads_BC})
|
||||
%! @anchor{dyn_first_order_solver}
|
||||
%! @sp 1
|
||||
%! Computes the first order reduced form of the DSGE model
|
||||
%! @sp 2
|
||||
%! @strong{Inputs}
|
||||
%! @sp 1
|
||||
%! @table @ @var
|
||||
%! @item jacobia
|
||||
%! Matrix containing the Jacobian of the model
|
||||
%! @item hessian
|
||||
%! Matrix containing the second order derivatives of the model
|
||||
%! @item dr
|
||||
%! Matlab's structure describing the reduced form solution of the model.
|
||||
%! @item M_
|
||||
%! Matlab's structure describing the model (initialized by @code{dynare}).
|
||||
%! @item threads_ABC
|
||||
%! Integer controlling number of threads in A_times_B_kronecker_C
|
||||
%! @item threads_BC
|
||||
%! Integer controlling number of threads in sparse_hessian_times_B_kronecker_C
|
||||
%! @end table
|
||||
%! @sp 2
|
||||
%! @strong{Outputs}
|
||||
%! @sp 1
|
||||
%! @table @ @var
|
||||
%! @item dr
|
||||
%! Matlab's structure describing the reduced form solution of the model.
|
||||
%! @end table
|
||||
%! @end deftypefn
|
||||
%@eod:
|
||||
|
||||
% Copyright (C) 2001-2011 Dynare Team
|
||||
%
|
||||
% This file is part of Dynare.
|
||||
%
|
||||
% Dynare is free software: you can redistribute it and/or modify
|
||||
% it under the terms of the GNU General Public License as published by
|
||||
% the Free Software Foundation, either version 3 of the License, or
|
||||
% (at your option) any later version.
|
||||
%
|
||||
% Dynare is distributed in the hope that it will be useful,
|
||||
% but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
% GNU General Public License for more details.
|
||||
%
|
||||
% You should have received a copy of the GNU General Public License
|
||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
dr.ghxx = [];
|
||||
dr.ghuu = [];
|
||||
dr.ghxu = [];
|
||||
|
@ -29,8 +77,8 @@ function dr = dyn_second_order_solver(jacobia,hessian1,dr,M_,threads_ABC,threads
|
|||
nk = size(kk,1);
|
||||
kk1 = reshape([1:nk^2],nk,nk);
|
||||
kk1 = kk1(kk,kk);
|
||||
hessian = hessian1(:,kk1(:));
|
||||
clear hessian1
|
||||
% reordering second order derivatives
|
||||
hessian = hessian(:,kk1(:));
|
||||
|
||||
zx = zeros(np,np);
|
||||
zu=zeros(np,M_.exo_nbr);
|
||||
|
|
|
@ -114,7 +114,8 @@ end
|
|||
if options.block
|
||||
[dr,info,M,options,oo] = dr_block(dr,check_flag,M,options,oo);
|
||||
else
|
||||
[dr,info,oo] = stochastic_solvers(dr,check_flag,M,options,oo);
|
||||
[dr,info] = stochastic_solvers(dr,check_flag,M,options,oo);
|
||||
oo.dr = dr;
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
function [dr,info,oo_] = stochastic_solvers(dr,task,M_,options_,oo_)
|
||||
function [dr,info] = stochastic_solvers(dr,task,M_,options_,oo_)
|
||||
% function [dr,info,M_,options_,oo_] = stochastic_solvers(dr,task,M_,options_,oo_)
|
||||
% computes the reduced form solution of a rational expectation model (first or second order
|
||||
% approximation of the stochastic model around the deterministic steady state).
|
||||
|
@ -21,7 +21,6 @@ function [dr,info,oo_] = stochastic_solvers(dr,task,M_,options_,oo_)
|
|||
% indeterminacy.
|
||||
% info=5: BK rank condition not satisfied.
|
||||
% info=6: The jacobian matrix evaluated at the steady state is complex.
|
||||
% oo_ [matlab structure] Results
|
||||
%
|
||||
% ALGORITHM
|
||||
% ...
|
||||
|
@ -170,7 +169,7 @@ else
|
|||
[dr,info] = AIM_first_order_solver(jacobia_,M_,dr,options_.qz_criterium);
|
||||
|
||||
else % use original Dynare solver
|
||||
[dr,info] = dyn_first_order_solver(jacobia_,b,M_,dr,options_,task);
|
||||
[dr,info] = dyn_first_order_solver(jacobia_,M_,dr,options_,task);
|
||||
if info
|
||||
return;
|
||||
end
|
||||
|
@ -207,4 +206,3 @@ else
|
|||
options_.threads.kronecker.sparse_hessian_times_B_kronecker_C);
|
||||
end
|
||||
end
|
||||
oo.dr = dr;
|
Loading…
Reference in New Issue