I just had a quick glance at your C code. I did not check the computation
of LWORK. Hope it's correct.
You have a problem with your array VR and VL.
If the flags JOBVL is 'N', DGEEV is not going to reference the array VL so
you might want to set it to JOBVL to simply a pointer on a double:
no need to allocate anything. Well, your implementation is memory
inefficient but this can not do any harm.
If the flags JOBVR is set to 'V', then DGEEV is going to output a N-by-N
matrix for the eigenvectors. So you need something like:
Then when you print your eigenvectors do not forget to have a double loop:
N components per eigenvectors + N eigenvectors.
If you want the eigenvalues, they come as real or complex-conjugate pairs
and there real/imaginary parts are in WR and WI arrays.
On Mon, 27 Nov 2006, rama krishna wrote:
I am trying to implement the "eig" function of Matlab in C with the use of
dgeev().........But when I compare the results obtatined with Matlab and
CLAPACK library, they resulted in different.
Here I am providing the code for your reference . If there is any mistake in
the usage of the function dgeev(), please help me out...
#define SIZE 4
dgeev_(&JOBVL, &JOBVR, &N, A, &LDA, WR, WI, VL, &LDVL, VR, &LDVR, WORK, &LWORK,
printf("\n INFO=%d\n", INFO );
printf("The Eigen vector is:\n");
I was expecting to get four eigen vectors, but this program resulted in only
one eigen vector.
Please help me out ....
Thanks in advance...
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.