Aaron
10-28-2007, 08:55 PM
I have a symmetric matrix that I am I trying to determine the eigen-values of, and the NR routines return the incorrect eigen-values.
For example, I'm trying to use the Householder reduction method on this matrix:
1 2 0
2 1 2
0 2 1
My implementation of this in code is:
MatDoub e(3,3);
e[0][0]=1;
e[0][1]=2;
e[0][2]=0;
e[1][0]=2;
e[1][1]=1;
e[1][2]=2;
e[2][0]=0;
e[2][1]=2;
e[2][2]=1;
MatrixPrint(e,1);
Symmeig evs(e);
printf("%f\n%f\n%f\n",evs.d[0],evs.d[1],evs.d[2]);
This returns the correctly formatted matrix and the eigen-values:
5.488767, -0.138240, -2.350527.
These values don't checkout as eigenvalues.
Mathcad returns the eigen-values: -1.828, 1, 3.828, which are correct.
Switching to the Unsymmeig functions, I get 3.788183, 0.000000, 1.020177 as the values.
Any advice, am I doing something wrong?
Thanks
For example, I'm trying to use the Householder reduction method on this matrix:
1 2 0
2 1 2
0 2 1
My implementation of this in code is:
MatDoub e(3,3);
e[0][0]=1;
e[0][1]=2;
e[0][2]=0;
e[1][0]=2;
e[1][1]=1;
e[1][2]=2;
e[2][0]=0;
e[2][1]=2;
e[2][2]=1;
MatrixPrint(e,1);
Symmeig evs(e);
printf("%f\n%f\n%f\n",evs.d[0],evs.d[1],evs.d[2]);
This returns the correctly formatted matrix and the eigen-values:
5.488767, -0.138240, -2.350527.
These values don't checkout as eigenvalues.
Mathcad returns the eigen-values: -1.828, 1, 3.828, which are correct.
Switching to the Unsymmeig functions, I get 3.788183, 0.000000, 1.020177 as the values.
Any advice, am I doing something wrong?
Thanks