public static void TestLapack() { Random rnd = new Random(); for (int n = 2; n < 50; n++) { var SomeMtx = MultidimensionalArray.Create(n, n); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { double r = rnd.NextDouble(); SomeMtx[i, j] += r; SomeMtx[j, i] += r; } } var eigs = SomeMtx.EigsSymm(); var(EigVal, EigVec) = SomeMtx.EigenspaceSymm(); var D = MultidimensionalArray.CreateDiagMtx(EigVal); var Test = EigVec.GEMM(D, EigVec.Transpose()); Test.Acc(-1.0, SomeMtx); double err = Test.InfNorm(); Assert.LessOrEqual(err, 1e-8); } }