NAME

diagonalize_symmetric - Diagonalizes a symmetric matrix

SYNOPSIS

#include "n/n_diagonalize.h"

Example compile flags (system dependent):
  -DLINUX_X86_64 -DLINUX_X86_64_OPTERON  -DGNU_COMPILER 
   -I/home/kobus/include
   -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
);

DESCRIPTION

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.

RETURNS

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

NOTE

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.

NOTE

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.

DISCLAIMER

This software is not adequatedly tested. It is recomended that results are checked independantly where appropriate.

AUTHOR

Kobus Barnard

DOCUMENTER

Kobus Barnard

SEE ALSO

diagonalize , diagonalize_2