Boost logo

Ublas :

Subject: Re: [ublas] [bindings] [lapack] geev and the type of the input matrix
From: Thomas Klimpel (Thomas.Klimpel_at_[hidden])
Date: 2010-07-05 16:45:31

Marco Guazzone wrote:
> However, there are situations where the input matrix has only real
> numbers and the output eigen{vectors,values} are complex.

Yes, and they will occur in complex conjugate pairs then.

> So, since (in addition to a complex matrix) a non-complex matrix may
> also give complex eigen{vectors,values}, why is the check on the
> value type not done on the output types (i.e., VectorW, MatrixVL,
> MatrixVL)?

Because this is an automatically generated straightforward binding against the corresponding lapack routine, without any further modifications for greater convenience.

> IMHO, this would avoid the user (e.g., me ;) ) to copy its working
> (possibly non-complex) matrix variable into a temp complex matrix
> before using lapack::geev.

You shouldn't do this. Just use the non-complex version of geev with your non-complex matrix, and decode the complex conjugate pairs in the output correctly. In case you just need the eigenvalues, all you need to do is create one vector of complex numbers from two vectors of real numbers without any special case handling. The decoding of the eigenvectors is less nice, and will also double the memory consumption.