NAME

diagonalize_2 - Diagonalizes a 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_2
(
	const Matrix *mp,
	Matrix **E_re_mpp,
	Matrix **E_im_mpp,
	Vector **D_re_vpp,
	Vector **D_im_vpp
);

DESCRIPTION

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. However, if this is the case, then use the routine diagonalize_symmetric(). If A is non-symmetric, but the eigenvalues are expected to be real regardless, then use the routine diagonalize(). In general, this routine assumes that all quantities may be complex. The matrix of eigenvectors is put into the matrix pointed to by *E_re_mpp and *E_im_mpp which are created or resized as needed. The diagonal matrix of eigenvalues is put into the vectors pointed to by *D_re_vpp and *D_im_vpp, which are also created or resized as needed. If any of these quantities are not needed, the arguments may be set to NULL.

RETURNS

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

NOTE

Unlike diagonalize() and diagonalize_symmetric() this routine does NOT sort eigenvalues/eigenvectors.

NOTE

Technically, we compute the "right" eigenvectors. If needed, this routine could be trivially modified to provide another diagonalization routine, diagonalize_3() which could provide, both "left" and "right" eigenvectors.

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_symmetric