Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Find eigenvalues and eigenvectors

anacondgame
Beginner
512 Views
I Have a 8x8 symmetric matrix A and I wont compute the eigenvalues and eigenvectors with dsyevd function.

The parameter are following:

...
// Var dichiaration

job = 'V';
uplo = 'L';  
n = 8;
lda = 8;
lwork = 3*pow(n,2)+(5+2*3)*n+1;
liwork = 5*n+2;

// alloc the vectors
work = (double*)calloc(lwork,sizeof(double));
w = (double*)calloc(n,sizeof(double));
iwork = (int*)calloc(liwork,sizeof(int));

// call
dsyevd for compute the eigenvalues and eigenvectors
dsyevd(&job,&uplo,&n,A,&lda,w,work,&lwork,iwork,&liwork,&info);
...

but the output program is incorrect !!? why?
help me, please!!!
0 Kudos
5 Replies
Zhanghong_T_
Novice
512 Views

(float *)--->(double *)

or

dsyevd--->ssyevd

0 Kudos
anacondgame
Beginner
512 Views
sorry, I have been wrong to write...
but the problem remains!
0 Kudos
anacondgame
Beginner
512 Views
the "A" matrix is a two-dimensional or one-dimensional array?

A = (double**)malloc(n*double*);
for(i=0; i
  A=(double*)calloc(n,sizeof(double));
 }
or
A = (double*)calloc(n,sizeof(double));

where n = 8 ?????
0 Kudos
TimP
Honored Contributor III
512 Views
It's a 2-dimensional Fortran array, not a **.
0 Kudos
Intel_C_Intel
Employee
512 Views

You can declare an array in C of size n*n of type double for !, and be sure to load in in Fortran style, i.e., column order, as I had stated in an earlier response.

lda will be set to n in this case.

Bruce

0 Kudos
Reply