After a question arose recently about finding complex eigenvalues of non-symmetric matrices, I wrote this example to show how it can be done with Math::GSL. The current example is called examples/matrix/nonsymmetric_eigen in the Math::GSL source, which will be in the 0.16 Math::GSL release. It uses the gsl_eigen_nonsymmv() function to do all the hard work, the rest is twiddling complex numbers. The documentation for this can be found with perldoc Math::GSL::Eigen or here.(The HTML rendering of the POD needs some work...) You can read the original C documentation for this function here.

It is a well known theorem of linear algebra that symmetric matrices can have only real eigenvalues. Thus it is much easier to find eigenvalues of symmetric matrices because there is no possibility of complex numbers arising. You can do this with Math::MatrixReal, which is written in pure-Perl.

The output of examples/matrix/nonsymmetric_eigen looks like:

Finding eigenvalue/eigenvectors for

[ 0 -1 ]

[ 1 0 ]

Eigenvectors:

u = (0.707106781186547,-0.707106781186547i)

v = (0.707106781186547,0.707106781186547i)

Eigenvalues:

lambda_0 = i

lambda_1 = -i

By the way, sqrt(2)/2 = 0.707106...

I am not quite happy with how long the program is, mainly because I have not written a Perlish interface around Complex Vectors and Matrices yet, so it is all in that script right now. The stringification could be built into the object and therefore reduce the length of that code dramatically.