diagonalize_symmetric - Diagonalizes a symmetric matrix


#include "n/n_diagonalize.h"

Example compile flags (system dependent):
   -L/home/kobus/misc/load/linux_x86_64_opteron -L/usr/lib/x86_64-linux-gnu
  -lKJB                               -lfftw3  -lgsl -lgslcblas -ljpeg  -lSVM -lstdc++                    -lpthread -lSLATEC -lg2c    -lacml -lacml_mv -lblas -lg2c      -lncursesw 

int diagonalize_symmetric
	const Matrix *mp,
	Matrix **E_mpp,
	Vector **D_vpp


Given a symmetric 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. Since A is symmetric, everything is real. If only the eigenvalues are needed, E_mpp can be set to NULL. 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. For development code (compiled with -DTEST), this routine prints a warning if the matrix is non symmetric (outside a threshold). For computing the eigenvalues, only the upper triangular part of the matrix is used.


NO_ERROR on success, and ERROR on failure, with an appropriate error message being set.


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.


Kobus Barnard


Kobus Barnard


diagonalize , diagonalize_2