Thanks for replying.
If I initialize the matrices in the code, it looks like this:
public static double[] AlgEigenvalues3() { double[,] a = new double[3,3]; a[0,0] = 9; a[0,1] = -2; a[0,2] = 0; a[1,0] = -3; a[1,1] = 4; a[1,2] = 7; a[2,0] = 4; a[2,1] = -4; a[2,2] = 0; int n = a.GetUpperBound(0); int vneeded = 0; double[] wr; double[] wi; double[,] vl; double[,] vr; bool s = alglib.rmatrixevd(a, n, vneeded, out wr, out wi, out vl, out vr); return wr; } public static double[] AlgEigenvalues4() { double[,] a = new double[3,3]; a[0,0] = 9; a[0,1] = -2; a[0,2] = 0; a[1,0] = -3; a[1,1] = 4; a[1,2] = 7; a[2,0] = 4; a[2,1] = -4; a[2,2] = 0; int n = a.GetUpperBound(0); int zneeded = 0; bool isupper = true; double[] d; double[,] z; bool s = alglib.smatrixevd(a, n, zneeded, isupper, out d, out z); return d; }
The answer are: 10 and 3 for AlgEigenvalues3 3.298438 and 9.701562 for AlgEigenvalues4
According to the URLs I posted, the reply should be: ( 8.970, 0.000i) ( 2.015, 4.218i) ( 2.015,-4.218i)
I can't see what I'm doing wrong...
|