Skip to content
Snippets Groups Projects
Commit dbd9e36d authored by sebastien's avatar sebastien
Browse files

v4.0: merged r2036 from trunk

git-svn-id: https://www.dynare.org/svn/dynare/branches/4.0@2037 ac1d8469-bf42-47a9-8791-bf33cf982152
parent ecfbc78f
Branches
No related tags found
No related merge requests found
...@@ -2,9 +2,32 @@ function e = SPAimerr(c); ...@@ -2,9 +2,32 @@ function e = SPAimerr(c);
% e = aimerr(c); % e = aimerr(c);
% %
% Interpret the return codes generated by the aim routines. % Interpret the return codes generated by the aim routines.
%
% The return code c = 2 is used by aim_schur.m but not by aim_eig.m. % The return code c = 2 is used by aim_schur.m but not by aim_eig.m.
% Original author: Gary Anderson
% Original file downloaded from:
% http://www.federalreserve.gov/Pubs/oss/oss4/code.html
% Adapted for Dynare by Dynare Team.
%
% This code is in the public domain and may be used freely.
% However the authors would appreciate acknowledgement of the source by
% citation of any of the following papers:
%
% Anderson, G. and Moore, G.
% "A Linear Algebraic Procedure for Solving Linear Perfect Foresight
% Models."
% Economics Letters, 17, 1985.
%
% Anderson, G.
% "Solving Linear Rational Expectations Models: A Horse Race"
% Computational Economics, 2008, vol. 31, issue 2, pages 95-113
%
% Anderson, G.
% "A Reliable and Computationally Efficient Algorithm for Imposing the
% Saddle Point Property in Dynamic Models"
% Journal of Economic Dynamics and Control, Forthcoming
if(c==1) e='Aim: unique solution.'; if(c==1) e='Aim: unique solution.';
elseif(c==2) e='Aim: roots not correctly computed by real_schur.'; elseif(c==2) e='Aim: roots not correctly computed by real_schur.';
elseif(c==3) e='Aim: too many big roots.'; elseif(c==3) e='Aim: too many big roots.';
......
...@@ -28,8 +28,31 @@ ...@@ -28,8 +28,31 @@
% nnumeric Number of numeric shiftrights. % nnumeric Number of numeric shiftrights.
% lgroots Number of roots greater in modulus than uprbnd. % lgroots Number of roots greater in modulus than uprbnd.
% aimcode Return code: see function aimerr. % aimcode Return code: see function aimerr.
% Modified to deal with infinite or nan A Dec 12 2007
% ========================================================= % Original author: Gary Anderson
% Original file downloaded from:
% http://www.federalreserve.gov/Pubs/oss/oss4/code.html
% Adapted for Dynare by Dynare Team, in order to deal
% with infinite or nan values.
%
% This code is in the public domain and may be used freely.
% However the authors would appreciate acknowledgement of the source by
% citation of any of the following papers:
%
% Anderson, G. and Moore, G.
% "A Linear Algebraic Procedure for Solving Linear Perfect Foresight
% Models."
% Economics Letters, 17, 1985.
%
% Anderson, G.
% "Solving Linear Rational Expectations Models: A Horse Race"
% Computational Economics, 2008, vol. 31, issue 2, pages 95-113
%
% Anderson, G.
% "A Reliable and Computationally Efficient Algorithm for Imposing the
% Saddle Point Property in Dynamic Models"
% Journal of Economic Dynamics and Control, Forthcoming
function [b,rts,ia,nexact,nnumeric,lgroots,aimcode] = ... function [b,rts,ia,nexact,nnumeric,lgroots,aimcode] = ...
SPAmalg(h,neq,nlag,nlead,condn,uprbnd) SPAmalg(h,neq,nlag,nlead,condn,uprbnd)
b=[];rts=[];ia=[];nexact=[];nnumeric=[];lgroots=[];aimcode=[]; b=[];rts=[];ia=[];nexact=[];nnumeric=[];lgroots=[];aimcode=[];
......
...@@ -3,6 +3,29 @@ ...@@ -3,6 +3,29 @@
% Build the companion matrix, deleting inessential lags. % Build the companion matrix, deleting inessential lags.
% Solve for x_{t+nlead} in terms of x_{t+nlag},...,x_{t+nlead-1}. % Solve for x_{t+nlead} in terms of x_{t+nlag},...,x_{t+nlead-1}.
% Original author: Gary Anderson
% Original file downloaded from:
% http://www.federalreserve.gov/Pubs/oss/oss4/code.html
% Adapted for Dynare by Dynare Team.
%
% This code in the public domain and may be used freely.
% However the authors would appreciate acknowledgement of the source by
% citation of any of the following papers:
%
% Anderson, G. and Moore, G.
% "A Linear Algebraic Procedure for Solving Linear Perfect Foresight
% Models."
% Economics Letters, 17, 1985.
%
% Anderson, G.
% "Solving Linear Rational Expectations Models: A Horse Race"
% Computational Economics, 2008, vol. 31, issue 2, pages 95-113
%
% Anderson, G.
% "A Reliable and Computationally Efficient Algorithm for Imposing the
% Saddle Point Property in Dynamic Models"
% Journal of Economic Dynamics and Control, Forthcoming
function [a,ia,js] = SPBuild_a(h,qcols,neq) function [a,ia,js] = SPBuild_a(h,qcols,neq)
left = 1:qcols; left = 1:qcols;
......
...@@ -3,6 +3,29 @@ ...@@ -3,6 +3,29 @@
% Copy the eigenvectors corresponding to the largest roots into the % Copy the eigenvectors corresponding to the largest roots into the
% remaining empty rows and columns js of q % remaining empty rows and columns js of q
% Author: Gary Anderson
% Original file downloaded from:
% http://www.federalreserve.gov/Pubs/oss/oss4/code.html
% Adapted for Dynare by Dynare Team.
%
% This code is in the public domain and may be used freely.
% However the authors would appreciate acknowledgement of the source by
% citation of any of the following papers:
%
% Anderson, G. and Moore, G.
% "A Linear Algebraic Procedure for Solving Linear Perfect Foresight
% Models."
% Economics Letters, 17, 1985.
%
% Anderson, G.
% "Solving Linear Rational Expectations Models: A Horse Race"
% Computational Economics, 2008, vol. 31, issue 2, pages 95-113
%
% Anderson, G.
% "A Reliable and Computationally Efficient Algorithm for Imposing the
% Saddle Point Property in Dynamic Models"
% Journal of Economic Dynamics and Control, Forthcoming
function q = SPCopy_w(q,w,js,iq,qrows) function q = SPCopy_w(q,w,js,iq,qrows)
if(iq < qrows) if(iq < qrows)
......
...@@ -5,6 +5,29 @@ ...@@ -5,6 +5,29 @@
% eigenvectors conformably. Map the eigenvectors into the real % eigenvectors conformably. Map the eigenvectors into the real
% domain. Count the roots bigger than uprbnd. % domain. Count the roots bigger than uprbnd.
% Original author: Gary Anderson
% Original file downloaded from:
% http://www.federalreserve.gov/Pubs/oss/oss4/code.html
% Adapted for Dynare by Dynare Team.
%
% This code is in the public domain and may be used freely.
% However the authors would appreciate acknowledgement of the source by
% citation of any of the following papers:
%
% Anderson, G. and Moore, G.
% "A Linear Algebraic Procedure for Solving Linear Perfect Foresight
% Models."
% Economics Letters, 17, 1985.
%
% Anderson, G.
% "Solving Linear Rational Expectations Models: A Horse Race"
% Computational Economics, 2008, vol. 31, issue 2, pages 95-113
%
% Anderson, G.
% "A Reliable and Computationally Efficient Algorithm for Imposing the
% Saddle Point Property in Dynamic Models"
% Journal of Economic Dynamics and Control, Forthcoming
function [w,rts,lgroots,flag_trouble] = SPEigensystem(a,uprbnd,rowsLeft) function [w,rts,lgroots,flag_trouble] = SPEigensystem(a,uprbnd,rowsLeft)
opts.disp=0; opts.disp=0;
try try
......
...@@ -2,6 +2,29 @@ ...@@ -2,6 +2,29 @@
% %
% Compute the exact shiftrights and store them in q. % Compute the exact shiftrights and store them in q.
% Original author: Gary Anderson
% Original file downloaded from:
% http://www.federalreserve.gov/Pubs/oss/oss4/code.html
% Adapted for Dynare by Dynare Team.
%
% This code is in the public domain and may be used freely.
% However the authors would appreciate acknowledgement of the source by
% citation of any of the following papers:
%
% Anderson, G. and Moore, G.
% "A Linear Algebraic Procedure for Solving Linear Perfect Foresight
% Models."
% Economics Letters, 17, 1985.
%
% Anderson, G.
% "Solving Linear Rational Expectations Models: A Horse Race"
% Computational Economics, 2008, vol. 31, issue 2, pages 95-113
%
% Anderson, G.
% "A Reliable and Computationally Efficient Algorithm for Imposing the
% Saddle Point Property in Dynamic Models"
% Journal of Economic Dynamics and Control, Forthcoming
function [h,q,iq,nexact] = SPExact_shift(h,q,iq,qrows,qcols,neq) function [h,q,iq,nexact] = SPExact_shift(h,q,iq,qrows,qcols,neq)
%hs=SPSparse(h); %hs=SPSparse(h);
......
...@@ -3,6 +3,29 @@ ...@@ -3,6 +3,29 @@
% %
% Compute the numeric shiftrights and store them in q. % Compute the numeric shiftrights and store them in q.
% Original author: Gary Anderson
% Original file downloaded from:
% http://www.federalreserve.gov/Pubs/oss/oss4/code.html
% Adapted for Dynare by Dynare Team.
%
% This code is in the public domain and may be used freely.
% However the authors would appreciate acknowledgement of the source by
% citation of any of the following papers:
%
% Anderson, G. and Moore, G.
% "A Linear Algebraic Procedure for Solving Linear Perfect Foresight
% Models."
% Economics Letters, 17, 1985.
%
% Anderson, G.
% "Solving Linear Rational Expectations Models: A Horse Race"
% Computational Economics, 2008, vol. 31, issue 2, pages 95-113
%
% Anderson, G.
% "A Reliable and Computationally Efficient Algorithm for Imposing the
% Saddle Point Property in Dynamic Models"
% Journal of Economic Dynamics and Control, Forthcoming
function [h,q,iq,nnumeric] = SPNumeric_shift(h,q,iq,qrows,qcols,neq,condn) function [h,q,iq,nnumeric] = SPNumeric_shift(h,q,iq,qrows,qcols,neq,condn)
nnumeric = 0; nnumeric = 0;
......
...@@ -14,6 +14,29 @@ ...@@ -14,6 +14,29 @@
% %
% scof observable structure coefficients % scof observable structure coefficients
% Original author: Gary Anderson
% Original file downloaded from:
% http://www.federalreserve.gov/Pubs/oss/oss4/code.html
% Adapted for Dynare by Dynare Team.
%
% This code is in the public domain and may be used freely.
% However the authors would appreciate acknowledgement of the source by
% citation of any of the following papers:
%
% Anderson, G. and Moore, G.
% "A Linear Algebraic Procedure for Solving Linear Perfect Foresight
% Models."
% Economics Letters, 17, 1985.
%
% Anderson, G.
% "Solving Linear Rational Expectations Models: A Horse Race"
% Computational Economics, 2008, vol. 31, issue 2, pages 95-113
%
% Anderson, G.
% "A Reliable and Computationally Efficient Algorithm for Imposing the
% Saddle Point Property in Dynamic Models"
% Journal of Economic Dynamics and Control, Forthcoming
function scof = SPObstruct(cof,cofb,neq,nlag,nlead) function scof = SPObstruct(cof,cofb,neq,nlag,nlead)
......
...@@ -2,6 +2,29 @@ ...@@ -2,6 +2,29 @@
% %
% Compute reduced-form coefficient matrix, b. % Compute reduced-form coefficient matrix, b.
% Original author: Gary Anderson
% Original file downloaded from:
% http://www.federalreserve.gov/Pubs/oss/oss4/code.html
% Adapted for Dynare by Dynare Team.
%
% This code is in the public domain and may be used freely.
% However the authors would appreciate acknowledgement of the source by
% citation of any of the following papers:
%
% Anderson, G. and Moore, G.
% "A Linear Algebraic Procedure for Solving Linear Perfect Foresight
% Models."
% Economics Letters, 17, 1985.
%
% Anderson, G.
% "Solving Linear Rational Expectations Models: A Horse Race"
% Computational Economics, 2008, vol. 31, issue 2, pages 95-113
%
% Anderson, G.
% "A Reliable and Computationally Efficient Algorithm for Imposing the
% Saddle Point Property in Dynamic Models"
% Journal of Economic Dynamics and Control, Forthcoming
function [nonsing,b] = SPReduced_form(q,qrows,qcols,bcols,neq,condn); function [nonsing,b] = SPReduced_form(q,qrows,qcols,bcols,neq,condn);
b=[]; b=[];
%qs=SPSparse(q); %qs=SPSparse(q);
......
...@@ -5,6 +5,29 @@ function [y] = SPShiftright(x,n) ...@@ -5,6 +5,29 @@ function [y] = SPShiftright(x,n)
% Shift the rows of x to the right by n columns, leaving zeros in the % Shift the rows of x to the right by n columns, leaving zeros in the
% first n columns. % first n columns.
% Original author: Gary Anderson
% Original file downloaded from:
% http://www.federalreserve.gov/Pubs/oss/oss4/code.html
% Adapted for Dynare by Dynare Team.
%
% This code is in the public domain and may be used freely.
% However the authors would appreciate acknowledgement of the source by
% citation of any of the following papers:
%
% Anderson, G. and Moore, G.
% "A Linear Algebraic Procedure for Solving Linear Perfect Foresight
% Models."
% Economics Letters, 17, 1985.
%
% Anderson, G.
% "Solving Linear Rational Expectations Models: A Horse Race"
% Computational Economics, 2008, vol. 31, issue 2, pages 95-113
%
% Anderson, G.
% "A Reliable and Computationally Efficient Algorithm for Imposing the
% Saddle Point Property in Dynamic Models"
% Journal of Economic Dynamics and Control, Forthcoming
[rows,cols] = size(x); [rows,cols] = size(x);
left = 1:cols-n; left = 1:cols-n;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment