Hello,

I'm pretty new to the forum.

I have the following problem:

I would like to calculate eigenvalues with a C program code. Now I suspect that the eigenvalue problem is wrongly conditioned. For this reason I would like to calculate the condition number. does anyone know how to program this?

Therefore I have inserted a part of the program here:

Code:

double c,f,g,r,s;
int i,j,k,l,done;
/* search for rows isolating an eigenvalue and push them down */
for (k = n - 1; k >= 0; k--) {
for (j = k; j >= 0; j--) {
for (i = 0; i <= k; i++) {
if (i != j && fabs(mat[pos(j,i,n)]) != 0) break;
}
if (i > k) {
scale[k] = j;
if (j != k) {
for (i = 0; i <= k; i++) {
c = mat[pos(i,j,n)];
mat[pos(i,j,n)] = mat[pos(i,k,n)];
mat[pos(i,k,n)] = c;
}
for (i = 0; i < n; i++) {
c = mat[pos(j,i,n)];
mat[pos(j,i,n)] = mat[pos(k,i,n)];
mat[pos(k,i,n)] = c;
}
}
break;
}
}
if (j < 0) break;
}

I would be very grateful for your help!

Best regards