public static void test_is_almost_zero() { Console.WriteLine("\nTesting is_almost_zero(Matrix A) ...\n"); Numeric n = new Numeric(); List<double[]> list3 = new List<double[]>() { new double[] { 4, 2, 1 }, new double[] { 2, 9, 3 }, new double[] { 1, 3, 16 } }; Matrix A = Matrix.from_list(list3); Matrix L = n.Cholesky(A); Console.WriteLine("\n\tA: " + A.ToString()); Console.WriteLine("\n\tExpect True: is_almost_zero(A - L*L.t) = " + n.is_almost_zero(A - L * L.Transpose())); }
public static void test_cholesky() { Console.WriteLine("\nTesting Cholesky(Matrix A) ...\n"); Numeric n = new Numeric(); List<double[]> list3 = new List<double[]>() { new double[] { 4, 2, 1 }, new double[] { 2, 9, 3 }, new double[] { 1, 3, 16 } }; Matrix A = Matrix.from_list(list3); Matrix L = n.Cholesky(A); Console.WriteLine("\n\tA: " + A.ToString()); Console.WriteLine("\n\tExpect: Cholesky(A) = [[2.0, 0, 0], [1.0, 2.8284271247461903, 0], [0.5, 0.88388347648318433, 3.8689468851355402]]"); Console.WriteLine("\t Result:Cholesky(A) = " + L.ToString()); }