hi, there
i am using zheev_() to calculate eigen value of hermitian matrices and i am under linux. it seems that double complex in C is not equivalent to complex*16 in FORTRAN. is there any way to fix this?
my test code is like this:
=====================================================================
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <complex.h>
#include <f2c.h>
#include <clapack.h>
int main(){
char v='v';
char u='u';
integer n=2;
integer info;
double complex A[4] = {2,-I,I,1};
double w[2];
integer lwork=66;
complex double work[66];
double rwork[66];
int i,j;
zheev_(&v,&u,&n,A,&n,w,work,&lwork,rwork,&info);
if (info != 0)
printf("error!");
//printf("%f\n", creal(work[0]));
for (i=0;i<2;++i){
printf("the %d-th one:", i+1);
for (j=0;j<2;++j)
printf("\t%f + %f i",creal(A[i*2+j]),cimag(A[i*2+j]));
printf("\n");
}
printf("eigen values:\n");
for (i=0;i<2;++i)
printf("%f\t",w[i]);
printf("\n");
return 0;
}
========================================================================
my gcc compiler give me two warnings:
gcc eigen.c -L/usr/local/lib -llapack -lblas -lF77 -lI77 -lm
eigen.c: In function `main':
eigen.c:21: warning: passing arg 4 of `zheev_' from incompatible pointer type
eigen.c:21: warning: passing arg 7 of `zheev_' from incompatible pointer type
Another issue is that if i use 'const char' for those control variables, I wil get warning for zheev_() , but there is no warning for zgemm_(), which is used to multiply matrices.