diff --git a/doc/AIM/Dynare AIM use Doc.html b/doc/AIM/Dynare AIM use Doc.html
index 300f75d49edc61d589f5b18cb1ae1d64fc354669..2b5821d855f36eae40443da95f8ad1f797eea90a 100644
--- a/doc/AIM/Dynare AIM use Doc.html	
+++ b/doc/AIM/Dynare AIM use Doc.html	
@@ -8,7 +8,7 @@ To make changes, update the M-file and republish this document.
       -->
       <title>Dunare AIM Solver Subsystem</title>
       <meta name="generator" content="MATLAB 7.1">
-      <meta name="date" content="2008-07-29">
+      <meta name="date" content="2008-09-02">
       <meta name="m-file" content="Dynare AIM use Doc"><style>
 
 body {
@@ -101,13 +101,10 @@ p.footer {
             <ul>
                <li>SPAmalg.m</li>
                <li>SPBuild_a.m</li>
-               <li>SPSparse.m</li>
                <li>SPShiftright.m</li>
                <li>SPExact_shift.m</li>
                <li>SPNumeric_shift.m</li>
                <li>SPObstruct.m</li>
-               <li>SPSparseSPBuild_a.m</li>
-               <li>SPEigQZ.m</li>
                <li>SPEigensystem.m</li>
                <li>SPReduced_form</li>
                <li>SPCopy_w.m</li>
@@ -245,13 +242,10 @@ p.footer {
 %
 % * SPAmalg.m
 % * SPBuild_a.m
-% * SPSparse.m
 % * SPShiftright.m
 % * SPExact_shift.m
 % * SPNumeric_shift.m
 % * SPObstruct.m
-% * SPSparseSPBuild_a.m
-% * SPEigQZ.m
 % * SPEigensystem.m
 % * SPReduced_form
 % * SPCopy_w.m
diff --git a/doc/AIM/Dynare AIM use Doc.mht b/doc/AIM/Dynare AIM use Doc.mht
index b537acf8f970d6efe9acb1e0d6f7c130cf092dd9..c299da4ec4f24d0a79ea470fdb3424074e0363f5 100644
--- a/doc/AIM/Dynare AIM use Doc.mht	
+++ b/doc/AIM/Dynare AIM use Doc.mht	
@@ -1,19 +1,19 @@
 From: <Saved by Microsoft Internet Explorer 5>
 Subject: Dunare AIM Solver Subsystem
-Date: Tue, 29 Jul 2008 14:27:04 +0100
+Date: Tue, 2 Sep 2008 22:25:31 +0100
 MIME-Version: 1.0
 Content-Type: multipart/related;
-	boundary="----=_NextPart_000_0022_01C8F187.2C5ADB50";
+	boundary="----=_NextPart_000_0000_01C90D4A.CF77DD90";
 	type="text/html"
 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
 
 This is a multi-part message in MIME format.
 
-------=_NextPart_000_0022_01C8F187.2C5ADB50
+------=_NextPart_000_0000_01C90D4A.CF77DD90
 Content-Type: text/html;
 	charset="utf-8"
 Content-Transfer-Encoding: quoted-printable
-Content-Location: file://C:\Documents%20and%20Settings\Sculptor\My%20Documents\Academia\Economics\Dynare%20DSGE\V4\matlab\AIM\html\Dynare%20AIM%20use%20Doc.html
+Content-Location: file://C:\Documents%20and%20Settings\Sculptor\My%20Documents\Academia\Economics\Dynare%20DSGE\V4\doc\AIM\Dynare%20AIM%20use%20Doc.html
 
 =EF=BB=BF<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 <HTML xmlns:mwsh =3D=20
@@ -25,7 +25,7 @@ This HTML is auto-generated from an M-file.=0A=
 To make changes, update the M-file and republish this document.=0A=
       -->
 <META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
-<META content=3D2008-07-29 name=3Ddate>
+<META content=3D2008-09-02 name=3Ddate>
 <META content=3D"Dynare AIM use Doc" name=3Dm-file>
 <STYLE>BODY {
 	MARGIN: 10px; BACKGROUND-COLOR: white
@@ -93,20 +93,20 @@ italic; TEXT-ALIGN: right
   <LI><A=20
   =
 href=3D"file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Aca=
-demia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc=
-.html#1">AIM=20
+demia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc.html#1"=
+>AIM=20
   Solver Subsystem</A>=20
   <LI><A=20
   =
 href=3D"file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Aca=
-demia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc=
-.html#2">APPENDIX=20
+demia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc.html#2"=
+>APPENDIX=20
   1: AIM System SPecification and Dynare Mapping</A>=20
   <LI><A=20
   =
 href=3D"file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Aca=
-demia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc=
-.html#11">APPENDIX=20
+demia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc.html#11=
+">APPENDIX=20
   2: dynAIMsolver1 Function Specification</A> </LI></UL></DIV>
 <H2>AIM Solver Subsystem<A name=3D1></A></H2>
 <P>The AIM subsystem in the AIM subdirectory of the main Dynare matlab =
@@ -139,13 +139,10 @@ names=20
 <UL>
   <LI>SPAmalg.m=20
   <LI>SPBuild_a.m=20
-  <LI>SPSparse.m=20
   <LI>SPShiftright.m=20
   <LI>SPExact_shift.m=20
   <LI>SPNumeric_shift.m=20
   <LI>SPObstruct.m=20
-  <LI>SPSparseSPBuild_a.m=20
-  <LI>SPEigQZ.m=20
   <LI>SPEigensystem.m=20
   <LI>SPReduced_form=20
   <LI>SPCopy_w.m=20
@@ -166,8 +163,7 @@ needed, i.e.: </P><PRE>  if (options_.useAIM =3D=3D 1) &amp;&amp; (task =
 the model=20
 <A=20
 href=3D"file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Aca=
-demia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/modelname">modelname</A>=
-.mod=20
+demia/Economics/Dynare%20DSGE/V4/doc/AIM/modelname">modelname</A>.mod=20
 file, before invoking, estimate and/or stoch_simul, or by issuing =
 appropriate=20
 command for estimate and/or stoch_simul. </P>
@@ -198,13 +194,13 @@ name=3D2></A></H2>
 <P>AIM System for thau lags and theta leads, and:</P>
 <P><IMG hspace=3D5=20
 src=3D"file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Acad=
-emia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc_=
-eq5664.png"=20
+emia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc_eq5664.p=
+ng"=20
 vspace=3D5> </P>
 <P><IMG hspace=3D5=20
 src=3D"file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Acad=
-emia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc_=
-eq45937.png"=20
+emia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc_eq45937.=
+png"=20
 vspace=3D5> </P>
 <P>where xt+i is system vectors at time t for all lag/lead t+i and zt is =
 vector=20
@@ -212,36 +208,36 @@ of exogenous shocks.</P>
 <P>The AIM input is array of matrices <B>H</B>: </P>
 <P><IMG hspace=3D5=20
 src=3D"file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Acad=
-emia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc_=
-eq45249.png"=20
+emia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc_eq45249.=
+png"=20
 vspace=3D5> </P>
 <P>and its solution given as:</P>
 <P><IMG hspace=3D5=20
 src=3D"file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Acad=
-emia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc_=
-eq69844.png"=20
+emia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc_eq69844.=
+png"=20
 vspace=3D5> </P>
 <P>where Xt is matrix of vectors of all current system variables and =
 forward=20
 looking leads xi for i=3Dt,...,t+theta:</P>
 <P><IMG hspace=3D5=20
 src=3D"file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Acad=
-emia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc_=
-eq235275.png"=20
+emia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc_eq235275=
+.png"=20
 vspace=3D5> </P>
 <P>and AIM output in the form of endogenous transition matrix <B>bb</B>: =
 </P>
 <P><IMG hspace=3D5=20
 src=3D"file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Acad=
-emia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc_=
-eq25810.png"=20
+emia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc_eq25810.=
+png"=20
 vspace=3D5> </P>
 <P>and, for simple case of one lag system, the matrix Phi derived =
 as:</P>
 <P><IMG hspace=3D5=20
 src=3D"file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Acad=
-emia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc_=
-eq13129.png"=20
+emia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc_eq13129.=
+png"=20
 vspace=3D5> </P>
 <P>For more lags, the phi equation becomes more complicated (see =
 documentation=20
@@ -254,20 +250,20 @@ fu' and=20
 expanded with zero columns represents <B>H</B>, i.e.: </P>
 <P><IMG hspace=3D5=20
 src=3D"file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Acad=
-emia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc_=
-eq372007.png"=20
+emia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc_eq372007=
+.png"=20
 vspace=3D5> </P>
 <P>and for exogenous shocks terms:</P>
 <P><IMG hspace=3D5=20
 src=3D"file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Acad=
-emia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc_=
-eq3403.png"=20
+emia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc_eq3403.p=
+ng"=20
 vspace=3D5> </P>
 <P><B>Output</B> Dynare solution output: </P>
 <P><IMG hspace=3D5=20
 src=3D"file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Acad=
-emia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc_=
-eq76947.png"=20
+emia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc_eq76947.=
+png"=20
 vspace=3D5> </P>
 <P>where Xt is again matrix of vectors all current system variables and =
 forward=20
@@ -282,8 +278,8 @@ output as=20
   phi in: </LI></UL></DIV>
 <P><IMG hspace=3D5=20
 src=3D"file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Acad=
-emia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc_=
-eq33587.png"=20
+emia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc_eq33587.=
+png"=20
 vspace=3D5> </P>
 <H2>APPENDIX 2: dynAIMsolver1 Function Specification<A =
 name=3D11></A></H2>
@@ -363,13 +359,10 @@ start with SP..=20
 %
 % * SPAmalg.m
 % * SPBuild_a.m
-% * SPSparse.m
 % * SPShiftright.m
 % * SPExact_shift.m
 % * SPNumeric_shift.m
 % * SPObstruct.m
-% * SPSparseSPBuild_a.m
-% * SPEigQZ.m
 % * SPEigensystem.m
 % * SPReduced_form
 % * SPCopy_w.m
@@ -557,10 +550,10 @@ used. =20
 ##### SOURCE END #####=0A=
 --></BODY></HTML>
 
-------=_NextPart_000_0022_01C8F187.2C5ADB50
+------=_NextPart_000_0000_01C90D4A.CF77DD90
 Content-Type: image/png
 Content-Transfer-Encoding: base64
-Content-Location: file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Academia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc_eq5664.png
+Content-Location: file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Academia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc_eq5664.png
 
 iVBORw0KGgoAAAANSUhEUgAAAFAAAAAMCAIAAAB6P612AAAAB3RJTUUH2AcdDRY2+RDUrQAAA4lJ
 REFUeJzdVT1IM1sQnf1JUFDQSMBKQhDFJgqGCIqNCNpYGJRoY2VEbLSwMCCC2AVFC0tJJaSQSBAL
@@ -581,10 +574,10 @@ rlSpQCCwsbFRVDaNTE5OLi8vz8zMHB0d0SAg4uvr6+HhYaltv/4ffnh4IISoI6lUKhKJCIKAiMlk
 kk4bEa+urui0/+DAFPl8fmtri7aM5jCyLKsvnqIfw38QVG0wGEyn0wMDA9+KVxL+Ajch9lxo447f
 AAAAAElFTkSuQmCC
 
-------=_NextPart_000_0022_01C8F187.2C5ADB50
+------=_NextPart_000_0000_01C90D4A.CF77DD90
 Content-Type: image/png
 Content-Transfer-Encoding: base64
-Content-Location: file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Academia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc_eq45937.png
+Content-Location: file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Academia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc_eq45937.png
 
 iVBORw0KGgoAAAANSUhEUgAAAJkAAAArCAIAAADkPL2TAAAAB3RJTUUH2AcdDRY4Hqj5qgAADRRJ
 REFUeJztWntQU0cX33tJSECGtLwMZJAWpbxECFDkIe0MjlY6mWHsgI+CLQoOdaq1nbFOpa3MVG1p
@@ -648,10 +641,10 @@ Okxo9vX1jYmJuXTpkru7+/bt22tqanbs2IE+dBA598AghG+++WZubi5K+WeCRS79/Pyio6ORwA8/
 zoevsAMzghYZGTkyMjI0NJScnIwutWeCldhncnIyICAArVHHonxU+B/lD/2JxqI+3AAAAABJRU5E
 rkJggg==
 
-------=_NextPart_000_0022_01C8F187.2C5ADB50
+------=_NextPart_000_0000_01C90D4A.CF77DD90
 Content-Type: image/png
 Content-Transfer-Encoding: base64
-Content-Location: file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Academia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc_eq45249.png
+Content-Location: file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Academia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc_eq45249.png
 
 iVBORw0KGgoAAAANSUhEUgAAAJwAAAAPCAIAAACeKDH3AAAAB3RJTUUH2AcdDRY7h6GoEAAABrhJ
 REFUeJztWF9IU18c/967azW3YqutqESwmQbpUHBbU2JjrAZGPaS9CGLZMKg9FVRPBj6UrwU9bFSu
@@ -686,10 +679,10 @@ ut9CrGDt/Xvy5MnMzIxerxdEL7b73aDyOQvRQViWbW9vJ0myo6NDoVDwD0gQxO/uhhvN+SyJSaXS
 rq6ua9euoaqyGTilUimXy9edllNdBf2c+YVYcUtkMplerxepIvxICPqFEIuVAsMwhmEMBgOKKBoM
 hULNzc3BYPA/TuEZCn2Jrp0AAAAASUVORK5CYII=
 
-------=_NextPart_000_0022_01C8F187.2C5ADB50
+------=_NextPart_000_0000_01C90D4A.CF77DD90
 Content-Type: image/png
 Content-Transfer-Encoding: base64
-Content-Location: file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Academia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc_eq69844.png
+Content-Location: file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Academia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc_eq69844.png
 
 iVBORw0KGgoAAAANSUhEUgAAANIAAAAqCAIAAABJOpJhAAAAB3RJTUUH2AcdDRcBWLZA4wAAETFJ
 REFUeJztXHlQk8f73zcnJBA55JBDDIIGwSMq5ajILa0i41SrlqqdcTr1qM6IDJ06Ha/pWGvb6SEz
@@ -771,10 +764,10 @@ DQYD/FYcL0FRVKvVMpnM9PT0kZERtVoNXwHZ0nj/Rrw7s4OBHZ/PHxwc7O/vp1Ao5eXl3d3dVCoV
 93YTExPLli1bt26dj4+Pj4+POSYlJSVCoRC83lMLG6YQ7/pyjMvlHj9+XKlUstnsOXPmWDAaC2cd
 tVqN/8cJG/6N+D/vdecohMuEjgAAAABJRU5ErkJggg==
 
-------=_NextPart_000_0022_01C8F187.2C5ADB50
+------=_NextPart_000_0000_01C90D4A.CF77DD90
 Content-Type: image/png
 Content-Transfer-Encoding: base64
-Content-Location: file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Academia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc_eq235275.png
+Content-Location: file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Academia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc_eq235275.png
 
 iVBORw0KGgoAAAANSUhEUgAAAFAAAAA0CAIAAACSFii2AAAAB3RJTUUH2AcdDRcEKNy0bAAAB6pJ
 REFUeJztW11ME00XPrvdWqrFn0RoAYuEZDFIRBpawQJq+RGjkmhExKDxonpBTIya9MagRiWSGI0x
@@ -813,10 +806,10 @@ jdOEkZf29vYeOXKkpaUlLi5OJBK1t7d3dXXFxMQAgEKhsNvt+fn5CoXin+DSaGSmpKRUVFQsWbLk
 fohaP1Nbva/VsgK6BJCamlpdXU1RFLocMG0NrAoej8cwTJAJow2zX+6i+N+DgCn+mzZtgllty16F
 QL/BJBwSEjLHvwDMfqfa/y8A7969+w/7VNSGSH2X+QAAAABJRU5ErkJggg==
 
-------=_NextPart_000_0022_01C8F187.2C5ADB50
+------=_NextPart_000_0000_01C90D4A.CF77DD90
 Content-Type: image/png
 Content-Transfer-Encoding: base64
-Content-Location: file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Academia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc_eq25810.png
+Content-Location: file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Academia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc_eq25810.png
 
 iVBORw0KGgoAAAANSUhEUgAAAI4AAAAPCAIAAAC9c2AiAAAAB3RJTUUH2AcdDRcHsdXl1gAABp5J
 REFUeJzFWG9IU98bf87ddY5lRVvliywbQ7IW2tgL819TmAk5on/0InyTL7JG0NvojzYLCSIQIYnV
@@ -851,10 +844,10 @@ bIpNdhz5XlJlHJY/e/Zs165d7N+Jya72AkzqF9+s+FN5ebnRaCwsLJRIJGzqt1mqx0VitBumCQDL
 y8uVlZUajSYUCmE1PJEkyXRdosyxrs762g1mF5zN/0trf1VwnfV/ALPgkLSXYJLzAAAAAElFTkSu
 QmCC
 
-------=_NextPart_000_0022_01C8F187.2C5ADB50
+------=_NextPart_000_0000_01C90D4A.CF77DD90
 Content-Type: image/png
 Content-Transfer-Encoding: base64
-Content-Location: file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Academia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc_eq13129.png
+Content-Location: file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Academia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc_eq13129.png
 
 iVBORw0KGgoAAAANSUhEUgAAAJgAAAAQCAIAAABlQyHDAAAAB3RJTUUH2AcdDRcJVm3I0QAACoRJ
 REFUeJzNWVtME9kbP2dm2jKViy3lYiFtRdR6Q3GzyiYY12VxEVFY1nuMt2giXmLUxQejDxg3Jj5o
@@ -906,10 +899,10 @@ f+CTvaur6/79+xiGaTSamTNngtHdS4AQLhohhBaLpbW1VSwWDw4OzpgxY8KECaMXEYrOTqfz1q1b
 OI7TNC2TydLT05EyBw4c+O2332Qy2YjUeHdd+ezZsxFnXWg4e/as2WzmQsgvPwK0/32U/+jrx/8V
 fv75556eHm7kdv0P9/SDU2IgcJ8AAAAASUVORK5CYII=
 
-------=_NextPart_000_0022_01C8F187.2C5ADB50
+------=_NextPart_000_0000_01C90D4A.CF77DD90
 Content-Type: image/png
 Content-Transfer-Encoding: base64
-Content-Location: file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Academia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc_eq372007.png
+Content-Location: file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Academia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc_eq372007.png
 
 iVBORw0KGgoAAAANSUhEUgAAARgAAAARCAIAAACJlCSnAAAAB3RJTUUH2AcdDRcMJgc8XgAAEaRJ
 REFUeJzdWnlUU0fUn5eVkA3CDoZVSBAoohhAEShQjwroUTxF6lo5FWh7WrVH7XE5XVyqtnZ114qo
@@ -993,10 +986,10 @@ l3f9+vW+vr41a9a0trbCBhcuXKirq3vRBCD6+/sPHz6sVCoPHz587NgxWPn48eMLFy7AlrDx2bNn
 cBAEWb58+cyZMzdv3gwAkMlkd+7ceeutt4DR7BgfH+/h4WFCHvlndgHvaE8XYQRBJtoT/7+CqS+b
 LwfmCxeZTMYw7H8AepLzydhZR1MAAAAASUVORK5CYII=
 
-------=_NextPart_000_0022_01C8F187.2C5ADB50
+------=_NextPart_000_0000_01C90D4A.CF77DD90
 Content-Type: image/png
 Content-Transfer-Encoding: base64
-Content-Location: file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Academia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc_eq3403.png
+Content-Location: file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Academia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc_eq3403.png
 
 iVBORw0KGgoAAAANSUhEUgAAADcAAAAPCAIAAADPkMDRAAAAB3RJTUUH2AcdDRcRRQFQhwAAA21J
 REFUeJzFlU8sK18Ux8/UNTptuqGtBNUgUZpGhERSFoSIRCX1p1bCRkTYsNDYdE2EsBDpjo2VSENi
@@ -1016,10 +1009,10 @@ cDjs9/udTmdpaanf7w+FQm8Xq6url5eX7e3tPp+PEJJKpQghS0tLbrebEDIwMOD1egkhGONvsH5a
 OU9PT3l5eX19fVarlRBCSzszMzM0NMSy7MHBQUVFxevrq06nI3/lb55loREZURQDgUBDQ4Mc4vHx
 cXh4WK/XWyyW8/PzxcXFzCb7J/oFYjg7tI9Xy/YAAAAASUVORK5CYII=
 
-------=_NextPart_000_0022_01C8F187.2C5ADB50
+------=_NextPart_000_0000_01C90D4A.CF77DD90
 Content-Type: image/png
 Content-Transfer-Encoding: base64
-Content-Location: file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Academia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc_eq76947.png
+Content-Location: file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Academia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc_eq76947.png
 
 iVBORw0KGgoAAAANSUhEUgAAANIAAAAqCAIAAABJOpJhAAAAB3RJTUUH2AcdDRcXrGL1sgAAEBlJ
 REFUeJztXHlQU1cXvy8JIoOMLAEXEGgFUcSlSEtRFAzUhSJoO61LW9TR2tJlWplx6lintbXbVKYi
@@ -1096,10 +1089,10 @@ IIQDAwN6bjc4OAgA+PzzzwEANTU1O3bsACbTtAWTFuPnduh1/s2bN2UymVqtrqurKy0tFYvF6Iwu
 AADDMBzHvby8du7c6eTkRD3OSmWCYditW7eKi4vBlO7jT22Mn9sh/1iyZMnDhw+bmpqCg4M9PT1N
 OI2JQrWtrc3oy3sL/i34H8GosRGcla9PAAAAAElFTkSuQmCC
 
-------=_NextPart_000_0022_01C8F187.2C5ADB50
+------=_NextPart_000_0000_01C90D4A.CF77DD90
 Content-Type: image/png
 Content-Transfer-Encoding: base64
-Content-Location: file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Academia/Economics/Dynare%20DSGE/V4/matlab/AIM/html/Dynare%20AIM%20use%20Doc_eq33587.png
+Content-Location: file:///C:/Documents%20and%20Settings/Sculptor/My%20Documents/Academia/Economics/Dynare%20DSGE/V4/doc/AIM/Dynare%20AIM%20use%20Doc_eq33587.png
 
 iVBORw0KGgoAAAANSUhEUgAAANEAAAAPCAIAAAD1bL3nAAAAB3RJTUUH2AcdDRccO7AsOgAACnVJ
 REFUeJztWXlMVNcXPneYzBsQd2AmIDuubbQpCLiQEtEUXMBoRBMJNeICSQe12oZWaUlKTdpkjDr/
@@ -1151,4 +1144,4 @@ S25ieE0JCCGlUvn06dP09PRVq1ZxKW5ra9NoNHv27Ll06dLSpUsrKyvRaJETQWdn59OnTxmGSUhI
 mDVr1jtI6sQ5jFP3bxV9fX3v5g+Dt4fXlGC327u7u+Pi4txycf369YKCgtzc3Lt37y5duvR/lLIs
 wy7Y5VwAAAAASUVORK5CYII=
 
-------=_NextPart_000_0022_01C8F187.2C5ADB50--
+------=_NextPart_000_0000_01C90D4A.CF77DD90--
diff --git a/doc/AIM/Dynare AIM use Doc.tex b/doc/AIM/Dynare AIM use Doc.tex
index 0b18f72f645e1b7f8760a30a85ea166b692d2eef..1f404d1ee036bc30e4498cda4d5b795090a1737a 100644
--- a/doc/AIM/Dynare AIM use Doc.tex	
+++ b/doc/AIM/Dynare AIM use Doc.tex	
@@ -1,246 +1,244 @@
-
-% This LaTeX was auto-generated from an M-file by MATLAB.
-% To make changes, update the M-file and republish this document.
-
-\documentclass{article}
-\usepackage{graphicx}
-\usepackage{color}
-
-\sloppy
-\definecolor{lightgray}{gray}{0.5}
-\setlength{\parindent}{0pt}
-
-\begin{document}
-
-    
-    
-\section*{Dunare AIM Solver Subsystem}
-
-
-\subsection*{Contents}
-
-\begin{itemize}
-\setlength{\itemsep}{-1ex}
-   \item AIM Solver Subsystem
-   \item APPENDIX 1: AIM System SPecification and Dynare Mapping
-   \item APPENDIX 2: dynAIMsolver1 Function Specification
-\end{itemize}
-
-
-\subsection*{AIM Solver Subsystem}
-
-\begin{par}
-The AIM subsystem in the AIM subdirectory of the main Dynare matlab directory contains Matlab functions necessary for using Gary Anderson's AIM 1st order solver as an alternative to Dynare's default mjdgges solver (see  \begin{verbatim}http://www.federalreserve.gov/Pubs/oss/oss4/aimindex.html\end{verbatim} ).
-\end{par} \vspace{1em}
-\begin{par}
-It cosists of:
-\end{par} \vspace{1em}
-\begin{itemize}
-\setlength{\itemsep}{-1ex}
-   \item New Dynare function \textbf{dynAIMsolver1(jacobia\_, M\_, dr)} which is called from \textbf{dr1.m} and which maps Dynare system to the AIM package subsystem. It then derives the solution for gy=dr.hgx and gu=dr.hgu from the AIM outputs. ("1" in the title is for 1st order solver).
-\end{itemize}
-\begin{itemize}
-\setlength{\itemsep}{-1ex}
-   \item A subset of Matlab routines from Gary Anderson's own AIM package needed to compute and solve system passed on and returned by dynAIMsolver1 whose names start with SP.. of which \textbf{SPAmalg.m} is the main driver:
-\end{itemize}
-\begin{itemize}
-\setlength{\itemsep}{-1ex}
-   \item SPAmalg.m
-   \item SPBuild\_a.m
-   \item SPSparse.m
-   \item SPShiftright.m
-   \item SPExact\_shift.m
-   \item SPNumeric\_shift.m
-   \item SPObstruct.m
-   \item SPSparseSPBuild\_a.m
-   \item SPEigQZ.m
-   \item SPEigensystem.m
-   \item SPReduced\_form
-   \item SPCopy\_w.m
-   \item SPAimerr.m
-\end{itemize}
-\begin{par}
-The path to the AIM directory, if exists, is added by \textbf{dynare\_config.m} using addpath
-\end{par} \vspace{1em}
-\begin{par}
-\textbf{USE:}
-\end{par} \vspace{1em}
-\begin{par}
-Dynare DR1.m tries to invoke AIM solver instead default mjdgges if options\_.useAIM == 1 is set and, if not check only, and if 1st order solution is needed, i.e.:
-\end{par} \vspace{1em}
-
-\begin{verbatim}  if (options_.useAIM == 1) && (task == 0) && (options_.order == 1)\end{verbatim}
-    \begin{par}
-For a start, options\_.useAIM = 0 is set by default in \textbf{global\_initialization.m} so that system uses mjdgges by default.
-\end{par} \vspace{1em}
-\begin{par}
-If AIM is to be used, options\_.useAIM = 1 needs to be set either in the model \begin{verbatim}modelname\end{verbatim}.mod file, before invoking, estimate and/or stoch\_simul, or by issuing appropriate command for estimate and/or stoch\_simul.
-\end{par} \vspace{1em}
-\begin{par}
-\textbf{RELEASE NOTES:}
-\end{par} \vspace{1em}
-\begin{par}
-In the current implementation, as of July 2008, only first order solution is supported and handling of exceptions is rather fundamental and, in particular, when Blanchard and Kahn conditions are not met, only a large penalty value 1.0e+8 is being set.
-\end{par} \vspace{1em}
-\begin{par}
-Hence, system may not coverge or the resluts may not be accurate if there were many messages like
-\end{par} \vspace{1em}
-\begin{itemize}
-\setlength{\itemsep}{-1ex}
-   \item "Error in AIM: aimcode=4 : Aim: too few big roots", or
-   \item "Error in AIM: aimcode=3 : Aim: too many big roots"
-\end{itemize}
-\begin{par}
-especially when issued close to the point of convergence.
-\end{par} \vspace{1em}
-\begin{par}
-However, if other exceptions occur and aimcode (see codes below) is higher than 5, the system resets options\_.useAIM = 0 and tries to use mjdgges instead.
-\end{par} \vspace{1em}
-
-
-\subsection*{APPENDIX 1: AIM System SPecification and Dynare Mapping}
-
-\begin{par}
-AIM System for thau lags and theta leads, and:
-\end{par} \vspace{1em}
-\begin{par}
-$$i=-\tau...+\theta $$
-\end{par} \vspace{1em}
-\begin{par}
-$$ \sum_{i=-\tau}^\theta(H_i*x_{t+i})= \Psi*z_t$$
-\end{par} \vspace{1em}
-\begin{par}
-where xt+i is system vectors at time t for all lag/lead t+i and zt is vector of exogenous shocks.
-\end{par} \vspace{1em}
-\begin{par}
-The AIM input is array of matrices \textbf{H}:
-\end{par} \vspace{1em}
-\begin{par}
-$$H=[H_{-\tau} \ ...\  H_i \ ...\ H_{+\theta}] $$
-\end{par} \vspace{1em}
-\begin{par}
-and its solution given as:
-\end{par} \vspace{1em}
-\begin{par}
-$$ X_t=\sum_{i=-\tau}^{-1}(B_i*x_{t+i}) + \phi*\Psi*z_t$$
-\end{par} \vspace{1em}
-\begin{par}
-where Xt is matrix of vectors of all current system variables and forward looking leads xi for i=t,...,t+theta:
-\end{par} \vspace{1em}
-\begin{par}
-$$X_t= \left[\begin{array}{c} {x_{t+\theta} } \\ {...} \\ {x_{t} } \end{array}\right]$$
-\end{par} \vspace{1em}
-\begin{par}
-and AIM output in the form of endogenous transition matrix \textbf{bb}:
-\end{par} \vspace{1em}
-\begin{par}
-$$bb=[B_{-\tau}...  B_i \ ...\ B_{-1}]$$
-\end{par} \vspace{1em}
-\begin{par}
-and, for simple case of one lag system, the  matrix Phi derived as:
-\end{par} \vspace{1em}
-\begin{par}
-$$ \phi=(H_O+H_1*B_{-1})^{-1}$$
-\end{par} \vspace{1em}
-\begin{par}
-For more lags, the phi equation becomes more complicated (see documentation on G.Anderson's site above).
-\end{par} \vspace{1em}
-\begin{par}
-\textbf{Dynare AIM Mapping - input}
-\end{par} \vspace{1em}
-\begin{par}
-For Dynare jacobian = [fy'-tau...  fy'i ... fy'+theta  fu'] - where -tau and +theta are subscripts, we have that its subset without exogenous term fu' and expanded with zero columns represents \textbf{H}, i.e.:
-\end{par} \vspace{1em}
-\begin{par}
-$$ [f_{y,-\tau}' \ ...\ f_{y,i}' \ ...\  f_{y,+\theta}']=[H_{-\tau} \ ...\  H_i \ ...\ H_{+\theta}] $$
-\end{par} \vspace{1em}
-\begin{par}
-and for exogenous shocks terms:
-\end{par} \vspace{1em}
-\begin{par}
-$$ f_u' = - \Psi$$
-\end{par} \vspace{1em}
-\begin{par}
-\textbf{Output} Dynare solution output:
-\end{par} \vspace{1em}
-\begin{par}
-$$ X_t = \sum_{i=-\tau}^{-1}(g_{y,t+i}*x_{t+i})+ g_u*z_t $$
-\end{par} \vspace{1em}
-\begin{par}
-where Xt is again matrix of vectors all current system variables and forward looking leads xi for i=t,..., t+theta, is mapped so that:
-\end{par} \vspace{1em}
-\begin{itemize}
-\setlength{\itemsep}{-1ex}
-   \item gy (or dr.ghx) is a reordered subset of AIM \textbf{SPAmalg.m} output \textbf{bb} without zero columns, and,
-   \item gu (or dr.ghu) is derived from reordered AIM \textbf{SPObstruct.m} output as phi in:
-\end{itemize}
-\begin{par}
-$$dr.ghu=g_u= - \phi * \Psi= - \phi * f_u'$$
-\end{par} \vspace{1em}
-
-
-\subsection*{APPENDIX 2: dynAIMsolver1 Function Specification}
-
-\begin{par}
-\textbf{function [dr,aimcode]=dynAIMsolver1(jacobia\_,M\_,dr)}
-\end{par} \vspace{1em}
-\begin{par}
-\textbf{INPUTS}
-\end{par} \vspace{1em}
-\begin{itemize}
-\setlength{\itemsep}{-1ex}
-   \item jacobia\_  - [matrix]           1st order derivative of the model
-   \item dr        - [matlab structure] Decision rules for stochastic simulations.
-   \item M\_        - [matlab structure] Definition of the model.
-\end{itemize}
-\begin{par}
-\textbf{OUTPUTS}
-\end{par} \vspace{1em}
-\begin{itemize}
-\setlength{\itemsep}{-1ex}
-   \item  dr         [matlab structure] Decision rules for stochastic simulations.
-   \item  aimcode    [integer]          status
-\end{itemize}
-
-\begin{verbatim}aimcode status is resolved by calling AIMerr as\end{verbatim}
-    \begin{itemize}
-\setlength{\itemsep}{-1ex}
-   \item     (c==1)  e='Aim: unique solution.';
-   \item     (c==2)  e='Aim: roots not correctly computed by real\_schur.';
-   \item     (c==3)  e='Aim: too many big roots.';
-   \item     (c==35) e='Aim: too many big roots, and q(:,right) is singular.';
-   \item     (c==4)  e='Aim: too few big roots.';
-   \item     (c==45) e='Aim: too few big roots, and q(:,right) is singular.';
-   \item     (c==5)  e='Aim: q(:,right) is singular.';
-   \item     (c==61) e='Aim: too many exact shiftrights.';
-   \item     (c==62) e='Aim: too many numeric shiftrights.';
-   \item     else    e='Aimerr: return code not properly specified';
-\end{itemize}
-\begin{par}
-\textbf{SPECIAL REQUIREMENTS}
-\end{par} \vspace{1em}
-\begin{par}
-Dynare use:
-\end{par} \vspace{1em}
-
-\begin{verbatim}     1) the lognormal block in DR1 is being invoked for some models and changing
-     values of ghx and ghy. We need to return the AIM output
-     values before that block and run the block with the current returned values
-     of gy (i.e. dr.ghx) and gu (dr.ghu) if it is needed even when the AIM is used
-     (it does not depend on mjdgges output).\end{verbatim}
-    
-\begin{verbatim}     2) for forward looking models, passing into dynAIMsolver aa ={Q'|1}*jacobia_
-     can produce ~ one order closer results to the Dynare solutiion
-     then when if plain jacobia_ is passed,
-     i.e. diff < e-14 for aa and diff < *e-13 for jacobia_ if Q' is used.\end{verbatim}
-    \begin{par}
-GP July 2008
-\end{par} \vspace{1em}
-\begin{par}
-part of DYNARE, copyright Dynare Team (1996-2008) Gnu Public License.
-\end{par} \vspace{1em}
-
-
-
-\end{document}
-    
+
+% This LaTeX was auto-generated from an M-file by MATLAB.
+% To make changes, update the M-file and republish this document.
+
+\documentclass{article}
+\usepackage{graphicx}
+\usepackage{color}
+
+\sloppy
+\definecolor{lightgray}{gray}{0.5}
+\setlength{\parindent}{0pt}
+
+\begin{document}
+
+    
+    
+\section*{Dunare AIM Solver Subsystem}
+
+
+\subsection*{Contents}
+
+\begin{itemize}
+\setlength{\itemsep}{-1ex}
+   \item AIM Solver Subsystem
+   \item APPENDIX 1: AIM System SPecification and Dynare Mapping
+   \item APPENDIX 2: dynAIMsolver1 Function Specification
+\end{itemize}
+
+
+\subsection*{AIM Solver Subsystem}
+
+\begin{par}
+The AIM subsystem in the AIM subdirectory of the main Dynare matlab directory contains Matlab functions necessary for using Gary Anderson's AIM 1st order solver as an alternative to Dynare's default mjdgges solver (see  \begin{verbatim}http://www.federalreserve.gov/Pubs/oss/oss4/aimindex.html\end{verbatim} ).
+\end{par} \vspace{1em}
+\begin{par}
+It cosists of:
+\end{par} \vspace{1em}
+\begin{itemize}
+\setlength{\itemsep}{-1ex}
+   \item New Dynare function \textbf{dynAIMsolver1(jacobia\_, M\_, dr)} which is called from \textbf{dr1.m} and which maps Dynare system to the AIM package subsystem. It then derives the solution for gy=dr.hgx and gu=dr.hgu from the AIM outputs. ("1" in the title is for 1st order solver).
+\end{itemize}
+\begin{itemize}
+\setlength{\itemsep}{-1ex}
+   \item A subset of Matlab routines from Gary Anderson's own AIM package needed to compute and solve system passed on and returned by dynAIMsolver1 whose names start with SP.. of which \textbf{SPAmalg.m} is the main driver:
+\end{itemize}
+\begin{itemize}
+\setlength{\itemsep}{-1ex}
+   \item SPAmalg.m
+   \item SPBuild\_a.m
+   \item SPSparse.m
+   \item SPShiftright.m
+   \item SPExact\_shift.m
+   \item SPNumeric\_shift.m
+   \item SPObstruct.m
+   \item SPEigensystem.m
+   \item SPReduced\_form
+   \item SPCopy\_w.m
+   \item SPAimerr.m
+\end{itemize}
+\begin{par}
+The path to the AIM directory, if exists, is added by \textbf{dynare\_config.m} using addpath
+\end{par} \vspace{1em}
+\begin{par}
+\textbf{USE:}
+\end{par} \vspace{1em}
+\begin{par}
+Dynare DR1.m tries to invoke AIM solver instead default mjdgges if options\_.useAIM == 1 is set and, if not check only, and if 1st order solution is needed, i.e.:
+\end{par} \vspace{1em}
+
+\begin{verbatim}  if (options_.useAIM == 1) && (task == 0) && (options_.order == 1)\end{verbatim}
+    \begin{par}
+For a start, options\_.useAIM = 0 is set by default in \textbf{global\_initialization.m} so that system uses mjdgges by default.
+\end{par} \vspace{1em}
+\begin{par}
+If AIM is to be used, options\_.useAIM = 1 needs to be set either in the model \begin{verbatim}modelname\end{verbatim}.mod file, before invoking, estimate and/or stoch\_simul, or by issuing appropriate command for estimate and/or stoch\_simul.
+\end{par} \vspace{1em}
+\begin{par}
+\textbf{RELEASE NOTES:}
+\end{par} \vspace{1em}
+\begin{par}
+In the current implementation, as of July 2008, only first order solution is supported and handling of exceptions is rather fundamental and, in particular, when Blanchard and Kahn conditions are not met, only a large penalty value 1.0e+8 is being set.
+\end{par} \vspace{1em}
+\begin{par}
+Hence, system may not coverge or the resluts may not be accurate if there were many messages like
+\end{par} \vspace{1em}
+\begin{itemize}
+\setlength{\itemsep}{-1ex}
+   \item "Error in AIM: aimcode=4 : Aim: too few big roots", or
+   \item "Error in AIM: aimcode=3 : Aim: too many big roots"
+\end{itemize}
+\begin{par}
+especially when issued close to the point of convergence.
+\end{par} \vspace{1em}
+\begin{par}
+However, if other exceptions occur and aimcode (see codes below) is higher than 5, the system resets options\_.useAIM = 0 and tries to use mjdgges instead.
+\end{par} \vspace{1em}
+
+
+\subsection*{APPENDIX 1: AIM System SPecification and Dynare Mapping}
+
+\begin{par}
+AIM System for thau lags and theta leads, and:
+\end{par} \vspace{1em}
+\begin{par}
+$$i=-\tau...+\theta $$
+\end{par} \vspace{1em}
+\begin{par}
+$$ \sum_{i=-\tau}^\theta(H_i*x_{t+i})= \Psi*z_t$$
+\end{par} \vspace{1em}
+\begin{par}
+where xt+i is system vectors at time t for all lag/lead t+i and zt is vector of exogenous shocks.
+\end{par} \vspace{1em}
+\begin{par}
+The AIM input is array of matrices \textbf{H}:
+\end{par} \vspace{1em}
+\begin{par}
+$$H=[H_{-\tau} \ ...\  H_i \ ...\ H_{+\theta}] $$
+\end{par} \vspace{1em}
+\begin{par}
+and its solution given as:
+\end{par} \vspace{1em}
+\begin{par}
+$$ X_t=\sum_{i=-\tau}^{-1}(B_i*x_{t+i}) + \phi*\Psi*z_t$$
+\end{par} \vspace{1em}
+\begin{par}
+where Xt is matrix of vectors of all current system variables and forward looking leads xi for i=t,...,t+theta:
+\end{par} \vspace{1em}
+\begin{par}
+$$X_t= \left[\begin{array}{c} {x_{t+\theta} } \\ {...} \\ {x_{t} } \end{array}\right]$$
+\end{par} \vspace{1em}
+\begin{par}
+and AIM output in the form of endogenous transition matrix \textbf{bb}:
+\end{par} \vspace{1em}
+\begin{par}
+$$bb=[B_{-\tau}...  B_i \ ...\ B_{-1}]$$
+\end{par} \vspace{1em}
+\begin{par}
+and, for simple case of one lag system, the  matrix Phi derived as:
+\end{par} \vspace{1em}
+\begin{par}
+$$ \phi=(H_O+H_1*B_{-1})^{-1}$$
+\end{par} \vspace{1em}
+\begin{par}
+For more lags, the phi equation becomes more complicated (see documentation on G.Anderson's site above).
+\end{par} \vspace{1em}
+\begin{par}
+\textbf{Dynare AIM Mapping - input}
+\end{par} \vspace{1em}
+\begin{par}
+For Dynare jacobian = [fy'-tau...  fy'i ... fy'+theta  fu'] - where -tau and +theta are subscripts, we have that its subset without exogenous term fu' and expanded with zero columns represents \textbf{H}, i.e.:
+\end{par} \vspace{1em}
+\begin{par}
+$$ [f_{y,-\tau}' \ ...\ f_{y,i}' \ ...\  f_{y,+\theta}']=[H_{-\tau} \ ...\  H_i \ ...\ H_{+\theta}] $$
+\end{par} \vspace{1em}
+\begin{par}
+and for exogenous shocks terms:
+\end{par} \vspace{1em}
+\begin{par}
+$$ f_u' = - \Psi$$
+\end{par} \vspace{1em}
+\begin{par}
+\textbf{Output} Dynare solution output:
+\end{par} \vspace{1em}
+\begin{par}
+$$ X_t = \sum_{i=-\tau}^{-1}(g_{y,t+i}*x_{t+i})+ g_u*z_t $$
+\end{par} \vspace{1em}
+\begin{par}
+where Xt is again matrix of vectors all current system variables and forward looking leads xi for i=t,..., t+theta, is mapped so that:
+\end{par} \vspace{1em}
+\begin{itemize}
+\setlength{\itemsep}{-1ex}
+   \item gy (or dr.ghx) is a reordered subset of AIM \textbf{SPAmalg.m} output \textbf{bb} without zero columns, and,
+   \item gu (or dr.ghu) is derived from reordered AIM \textbf{SPObstruct.m} output as phi in:
+\end{itemize}
+\begin{par}
+$$dr.ghu=g_u= - \phi * \Psi= - \phi * f_u'$$
+\end{par} \vspace{1em}
+
+
+\subsection*{APPENDIX 2: dynAIMsolver1 Function Specification}
+
+\begin{par}
+\textbf{function [dr,aimcode]=dynAIMsolver1(jacobia\_,M\_,dr)}
+\end{par} \vspace{1em}
+\begin{par}
+\textbf{INPUTS}
+\end{par} \vspace{1em}
+\begin{itemize}
+\setlength{\itemsep}{-1ex}
+   \item jacobia\_  - [matrix]           1st order derivative of the model
+   \item dr        - [matlab structure] Decision rules for stochastic simulations.
+   \item M\_        - [matlab structure] Definition of the model.
+\end{itemize}
+\begin{par}
+\textbf{OUTPUTS}
+\end{par} \vspace{1em}
+\begin{itemize}
+\setlength{\itemsep}{-1ex}
+   \item  dr         [matlab structure] Decision rules for stochastic simulations.
+   \item  aimcode    [integer]          status
+\end{itemize}
+
+\begin{verbatim}aimcode status is resolved by calling AIMerr as\end{verbatim}
+    \begin{itemize}
+\setlength{\itemsep}{-1ex}
+   \item     (c==1)  e='Aim: unique solution.';
+   \item     (c==2)  e='Aim: roots not correctly computed by real\_schur.';
+   \item     (c==3)  e='Aim: too many big roots.';
+   \item     (c==35) e='Aim: too many big roots, and q(:,right) is singular.';
+   \item     (c==4)  e='Aim: too few big roots.';
+   \item     (c==45) e='Aim: too few big roots, and q(:,right) is singular.';
+   \item     (c==5)  e='Aim: q(:,right) is singular.';
+   \item     (c==61) e='Aim: too many exact shiftrights.';
+   \item     (c==62) e='Aim: too many numeric shiftrights.';
+   \item     else    e='Aimerr: return code not properly specified';
+\end{itemize}
+\begin{par}
+\textbf{SPECIAL REQUIREMENTS}
+\end{par} \vspace{1em}
+\begin{par}
+Dynare use:
+\end{par} \vspace{1em}
+
+\begin{verbatim}     1) the lognormal block in DR1 is being invoked for some models and changing
+     values of ghx and ghy. We need to return the AIM output
+     values before that block and run the block with the current returned values
+     of gy (i.e. dr.ghx) and gu (dr.ghu) if it is needed even when the AIM is used
+     (it does not depend on mjdgges output).\end{verbatim}
+    
+\begin{verbatim}     2) for forward looking models, passing into dynAIMsolver aa ={Q'|1}*jacobia_
+     can produce ~ one order closer results to the Dynare solutiion
+     then when if plain jacobia_ is passed,
+     i.e. diff < e-14 for aa and diff < *e-13 for jacobia_ if Q' is used.\end{verbatim}
+    \begin{par}
+GP July 2008
+\end{par} \vspace{1em}
+\begin{par}
+part of DYNARE, copyright Dynare Team (1996-2008) Gnu Public License.
+\end{par} \vspace{1em}
+
+
+
+\end{document}
+