From 47808a0eb74dc22e71432387d0d7b2ef73b130d0 Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan.bastani@ens.fr>
Date: Fri, 8 Jun 2012 14:46:24 +0200
Subject: [PATCH] place AIM function calls at top of file

---
 matlab/AIM/SPAmalg.m         | 4 ++--
 matlab/AIM/SPBuild_a.m       | 2 +-
 matlab/AIM/SPCopy_w.m        | 2 +-
 matlab/AIM/SPEigensystem.m   | 2 +-
 matlab/AIM/SPExact_shift.m   | 2 +-
 matlab/AIM/SPNumeric_shift.m | 2 +-
 matlab/AIM/SPObstruct.m      | 2 +-
 matlab/AIM/SPReduced_form.m  | 2 +-
 8 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/matlab/AIM/SPAmalg.m b/matlab/AIM/SPAmalg.m
index 6438cf39b8..41307b445e 100644
--- a/matlab/AIM/SPAmalg.m
+++ b/matlab/AIM/SPAmalg.m
@@ -1,3 +1,5 @@
+function [b,rts,ia,nexact,nnumeric,lgroots,aimcode] = ...
+                        SPAmalg(h,neq,nlag,nlead,condn,uprbnd)
 %  [b,rts,ia,nexact,nnumeric,lgroots,aimcode] = ...
 %                       SPAmalg(h,neq,nlag,nlead,condn,uprbnd)
 %
@@ -54,8 +56,6 @@
 % Journal of Economic Dynamics and Control, 2010, vol. 34, issue 3,
 % pages 472-489
 
-function [b,rts,ia,nexact,nnumeric,lgroots,aimcode] = ...
-                        SPAmalg(h,neq,nlag,nlead,condn,uprbnd)
 b=[];rts=[];ia=[];nexact=[];nnumeric=[];lgroots=[];aimcode=[];
 if(nlag<1 || nlead<1) 
     error('Aim_eig: model must have at least one lag and one lead');
diff --git a/matlab/AIM/SPBuild_a.m b/matlab/AIM/SPBuild_a.m
index b2d8d90225..eb12473a8a 100644
--- a/matlab/AIM/SPBuild_a.m
+++ b/matlab/AIM/SPBuild_a.m
@@ -1,3 +1,4 @@
+function [a,ia,js] = SPBuild_a(h,qcols,neq)
 %  [a,ia,js] = SPBuild_a(h,qcols,neq)
 %
 %  Build the companion matrix, deleting inessential lags.
@@ -27,7 +28,6 @@
 % Journal of Economic Dynamics and Control, 2010, vol. 34, issue 3,
 % pages 472-489
 
-function [a,ia,js] = SPBuild_a(h,qcols,neq)
 
 left  = 1:qcols;
 right = qcols+1:qcols+neq;
diff --git a/matlab/AIM/SPCopy_w.m b/matlab/AIM/SPCopy_w.m
index de39c0ec1b..714a1e2746 100644
--- a/matlab/AIM/SPCopy_w.m
+++ b/matlab/AIM/SPCopy_w.m
@@ -1,3 +1,4 @@
+function  q = SPCopy_w(q,w,js,iq,qrows)
 % q = SPCopy_w(q,w,js,iq,qrows)
 %
 %  Copy the eigenvectors corresponding to the largest roots into the
@@ -27,7 +28,6 @@
 % Journal of Economic Dynamics and Control, 2010, vol. 34, issue 3,
 % pages 472-489
 
-function  q = SPCopy_w(q,w,js,iq,qrows)
 
 if(iq < qrows)
    lastrows = iq+1:qrows;
diff --git a/matlab/AIM/SPEigensystem.m b/matlab/AIM/SPEigensystem.m
index 7a83c36cce..16855401a5 100644
--- a/matlab/AIM/SPEigensystem.m
+++ b/matlab/AIM/SPEigensystem.m
@@ -1,3 +1,4 @@
+function [w,rts,lgroots,flag_trouble] = SPEigensystem(a,uprbnd,rowsLeft)
 %  [w,rts,lgroots] = SPEigensystem(a,uprbnd)
 %
 %  Compute the roots and the left eigenvectors of the companion
@@ -29,7 +30,6 @@
 % Journal of Economic Dynamics and Control, 2010, vol. 34, issue 3,
 % pages 472-489
 
-function [w,rts,lgroots,flag_trouble] = SPEigensystem(a,uprbnd,rowsLeft) 
 opts.disp=0; 
 % next block is commented out because eigs() intermitently returns different rts
 %try
diff --git a/matlab/AIM/SPExact_shift.m b/matlab/AIM/SPExact_shift.m
index 5f3700553a..c9034e319b 100644
--- a/matlab/AIM/SPExact_shift.m
+++ b/matlab/AIM/SPExact_shift.m
@@ -1,3 +1,4 @@
+function [h,q,iq,nexact] = SPExact_shift(h,q,iq,qrows,qcols,neq)
 % [h,q,iq,nexact] = exact_shift(h,q,iq,qrows,qcols,neq)
 %
 % Compute the exact shiftrights and store them in q.
@@ -26,7 +27,6 @@
 % Journal of Economic Dynamics and Control, 2010, vol. 34, issue 3,
 % pages 472-489
 
-function [h,q,iq,nexact] = SPExact_shift(h,q,iq,qrows,qcols,neq)
 
 %hs=SPSparse(h);
 hs=sparse(h);
diff --git a/matlab/AIM/SPNumeric_shift.m b/matlab/AIM/SPNumeric_shift.m
index 38ee857591..cc1e1825f7 100644
--- a/matlab/AIM/SPNumeric_shift.m
+++ b/matlab/AIM/SPNumeric_shift.m
@@ -1,3 +1,4 @@
+function [h,q,iq,nnumeric] = SPNumeric_shift(h,q,iq,qrows,qcols,neq,condn)
 %  [h,q,iq,nnumeric] = ...
 %             SPNumeric_shift(h,q,iq,qrows,qcols,neq,condn)
 %
@@ -27,7 +28,6 @@
 % Journal of Economic Dynamics and Control, 2010, vol. 34, issue 3,
 % pages 472-489
 
-function [h,q,iq,nnumeric] = SPNumeric_shift(h,q,iq,qrows,qcols,neq,condn)
 
 nnumeric = 0;
 left     = 1:qcols;
diff --git a/matlab/AIM/SPObstruct.m b/matlab/AIM/SPObstruct.m
index 392781081b..8620ca1b9b 100644
--- a/matlab/AIM/SPObstruct.m
+++ b/matlab/AIM/SPObstruct.m
@@ -1,3 +1,4 @@
+function scof = SPObstruct(cof,cofb,neq,nlag,nlead)
 % scof = SPObstruct(cof,cofb,neq,nlag,nlead)
 %
 % Construct the coefficients in the observable structure.
@@ -38,7 +39,6 @@
 % Journal of Economic Dynamics and Control, 2010, vol. 34, issue 3,
 % pages 472-489
 
-function scof = SPObstruct(cof,cofb,neq,nlag,nlead)
 
 
 % Append the negative identity to cofb
diff --git a/matlab/AIM/SPReduced_form.m b/matlab/AIM/SPReduced_form.m
index d7ddd8a91b..3d5c889907 100644
--- a/matlab/AIM/SPReduced_form.m
+++ b/matlab/AIM/SPReduced_form.m
@@ -1,3 +1,4 @@
+function [nonsing,b] = SPReduced_form(q,qrows,qcols,bcols,neq,condn);
 % [nonsing,b] = SPReduced_form(q,qrows,qcols,bcols,neq,b,condn);
 %
 % Compute reduced-form coefficient matrix, b.
@@ -26,7 +27,6 @@
 % Journal of Economic Dynamics and Control, 2010, vol. 34, issue 3,
 % pages 472-489
 
-function [nonsing,b] = SPReduced_form(q,qrows,qcols,bcols,neq,condn);
 b=[];
 %qs=SPSparse(q);
 qs=sparse(q);
-- 
GitLab