The mfiles directory contains two matlab files, gensys.m and gensysct.m, that analyze linear rational expectations systems and return solutions for their dependence on exogenous disturbances. The systems need not have non-singular lead matrices (coefficients on current variables in discrete time, on derivatives in continuous time) and they need not be well-specified. The program analyzes them to determine whether solutions exist and whether they are unique. It returns a solution even when it is not unique, and it returns a solution that constrains exogenous variable behavior when no solution that does not do so exists.
The continuous time program, unlike the discrete time program, handles only the case of serially uncorrelated exogenous processes.
The files qzdiv.m, qzdivct.m, and qzswitch.m are required by the gensys.m programs. If you try to implement the algorithm in non-Matlab languages, you will need to find or write a routine that does the complex QZ (or generalized Schur) decomposition. Fortran routines that do this are available in the ACM algorithm files or LAPACK.
A newer edition of gensys, with some improvements (though possibly with still an unknown bug or two --- please report any you find --- is available in the R subdirectory. This version of the program is written in R, the open source version of S. It should run directly on any Suse 9-10 linux system and with very minor change (in the line in qz.r giving the location of the liblapack.so library file) on any unix system. It probably will also work on Windows systems where lapack is available as a .dll file, but I haven't tried this.
R is available from http://www.r-project.org/
Octave is an open-source program that is largely compatible with Matlab. However, some functions with the same name as corresponding Matlab functions return different values. The qz function is one of these, unfortunately. It transposes one of q or z, relative to what matlab returns as q or z. Furthermore, it does only the real generalized Schur decomposition, which will be enough for some models, but not for all. James Murray (jmmurray at indiana.edu) has provided a version of gensys that works in octave. It requires that you compile a new version of the qz command from C and Fortran code. On Unix machines at least, this is very straightforward and is explained in the zip file.Chris Sims