Eigenvalues of a real general matrix
geneigen calculates the eigenvalues of a square matrix. The eigenvalues of a square symmetric matrix may be calculated by mat symeigen, but official Stata cannot calculate the eigenvalues of a nonsymmetric matrix. geneigen executes EISPACK code to calculate the eigenvalues' real part, imaginary part, and modulus via the QR algorithm for real Hessenberg matrices, as described in Press et al. (1992, Chapter 11).
The routine returns a N by 4 matrix r(eigen), containing, respectively, the modulus, real part, imaginary part, and cumulated modulus. The eigenvalues are sorted in order of ascending moduli.
If Stata considers a matrix to be symmetric, its own mat symeigen routine should be used rather than this routine.
. mat kk=(1,2,3\-6,-8,-14\122,345,678)
. geneigen kk
. return list
The routine makes use of Jeroen Weesie's qsortidx routine, part of his very useful qsort package. Thanks to Paul McGale for noting an error in the translation of the routine.
Press, William H., Teukolsky, Saul A., Vetterling, William T. and Brian P. Flan > nery. Numerical Recipes in C, Second Edition. Cambridge: Cambridge University Press, > 1992.
Christopher F Baum, Boston College, USA, firstname.lastname@example.org