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


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.


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


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


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.


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_symmetric