I am working on eigenvectors with lapacke in C code and I was wondering how are they built when the the eigenvalue has a imaginary part? I mean I have to malloc on the same dimension as if they were only real, so how is the eigenvectors built?
Thank you
If the matrix is real, double precision, finding the eigenvalues and eigenvectors for such a general matrix could be performed in C by using
LAPACKE_dgeev()from LAPACKE. LAPACKE is an interface to LAPACK. Hence, the documentation about thedgeev()function likely answers your question :While the real and complex parts of eigenvalues are stored in two different arrays
WRandWI, the eigenvectors, including those featuring a complex part, are completely stored in a real double precision array of size NxN. It is possible because the eigenvectors corresponding to a pair of complex conjugate eigenvalues are pointwise complex conjugate of one another.An example showing how to handle complex eigenvectors found by
LAPACKE_dgeev()is available in this Intel code sampleThis interleaving technique is also featured in LAPACK
sgeev()for single precision real general matrices.