Re: Calculating EigenValues with CLAPACK




In article <1166553970.140364.313330@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"ist" <saygin@xxxxxxxxx> writes:
Hi,
This may be a lame question but, can you help me about calculating
eigenvalues with CLAPACK?
I have tried a simple C code to accomplish this for a 4x4 symmetric
upper-triangle matrix:

1 2 3 4
x 5 6 7
x x 8 9
x x x 10

Here is my code:

float ap[]={1,2,3,4,5,6,7,8,9,10};
float d[4];
float e[3];
float tau[3];
long info;
long n=4;
long ldz=n; // When <n CLAPACK gives parameter error, otherwise VC++
gives Access Violation
float work=(2*n)-2;
ssptrd_("U",&n,ap,d,e,tau,&info);
printf("%d\n",info); // This step outputs 0
ssteqr_("V",&n,d,e,ap,&ldz,&work,&info);
printf("%d\n",info);


you made a lot of errors here:
first of all, all parameters muts be pointers, hence direct parameters
"U" and "V" are not allowed.
the matrix ap must be stroed in column order , read the "readme" for clapack.
in ssteqr you want the eigenvalues too hence you must supply the pointer
for this matrix, which on entry must contain the already computed orthogonal
transformation used for computing the tridiagonal form. this is _not_ ap,
in ap the information is only in condensed form (only information about the
householder reflectors is there. hence there must be something like
float z[4][4] ;
hth
peter
.



Relevant Pages