diagonalize - Diagonalizes a matrix
Example compile flags (system dependent):
-DLINUX_X86_64 -DLINUX_X86_64_OPTERON -DGNU_COMPILER
-lKJB -lfftw3 -lgsl -lgslcblas -ljpeg -lSVM -lstdc++ -lpthread -lSLATEC -lg2c -lacml -lacml_mv -lblas -lg2c -lncursesw
const Matrix *mp,
Given a matrix A, this routine computes A = E*D*inv(E), where D is diagonal,
and contains the eigenvalues of A, and the columns of E contain the
eigenvectors. If A is symmetric, then the eigenvalues are real. If A is not
symmetric, then the eigenvalues may, or may not be real. Currently, this
routine only returns the real parts of the eigenvalues, and prints a warning
message if any of the imaginary components of the eigenvalues exceed a
certain threshold. For many applications, the routines
diagonalize_symmetric(), and diagonalize_2() are prefered (see below).
The matrix of eigenvectors is put into the matrix pointed to by *E_mpp,
which is created or resized as needed. The diagonal matrix of eigenvalues is
put into the vector pointed to by *D_vpp, which is also created or
resized as needed.
NO_ERROR on success, and ERROR on failure, with an appropriate error
message being set.
The underlying assumption of this routine is that the matrix to be
diagonalized is NOT symmetric, BUT you are expecting essentially real
eigenvectors (this was the case for the first application which led to
this wrapper). If the matrix is symmetric, this routine will work, but
diagonalize_symmetric() should be better. If the matrix is suspected of
having complex eigenvectors/eigenvalues, then use the routine
diagonalize_2() as this one will print a warning for each eigenvalue with
absolute value of the imaginary part greater than 0.0001 of the maximum
absolute value of all the eigenvalues.
This routine sorts the eigenvalues and eigenvectors from largest to
smallest (opposite of Matlab). Also, the matrix of eigenvectors is
ambigous up to a sign, so if you compare the results with other
eigensolvers, you may have to multiply one of the results by -1.
This routine requires that that the LAPACK library is available. If this
file was compiled without the presence of that library, then this routine
will return ERROR.
This software is not adequatedly tested. It is recomended that
results are checked independantly where appropriate.