static void Main(string[] args) { Jacobi jacobi = new Jacobi(); while (choice == 1) { List<double> offsets = new List<double>(); List<double> _offsets = new List<double>(); try { String time = DateTime.Now.TimeOfDay.TotalMinutes.ToString(); Console.Out.WriteLine("Current Time of Day is " + DateTime.Now.TimeOfDay); Console.Out.WriteLine("\n<<<Please close the Excel Report before running the Program>>>"); double[,] matrix = new double[5, 5]; Random gen = new Random(); Console.Out.Write("\n\t"); for (byte i = 0; i < matrix.GetLength(0); ++i) { for (byte j = 0; j < matrix.GetLength(1); ++j) { matrix[i, j] = matrix[j, i] = gen.NextDouble() * 100; } } // double[,] matrix = { { 2, 1, 1 }, { 1, 2, 1 }, { 1, 1, 2 } }; double[,] originalMatrix = matrix; offsets.Add(jacobi.off(matrix)); _offsets.Add(jacobi.off(matrix)); offsets.AddRange(jacobi.run(ref matrix, 1)); Console.Out.WriteLine("\n\n"); generateReport(offsets, originalMatrix, matrix, 1); matrix = originalMatrix; _offsets.AddRange(jacobi.run(ref matrix, 2)); generateReport(_offsets, originalMatrix, matrix, 2); Console.Out.WriteLine("\n\nNumber of Iterations: \n\tWith Sorting: " + offsets.Count + "\n\tWithout Sorting: " + _offsets.Count); System.Diagnostics.Process.Start("Report.xlsx"); Console.Out.WriteLine("\n01: Run Again\n02: Exit"); choice = Int32.Parse(Console.ReadLine()); Console.Clear(); } catch (IOException) { Console.Clear(); Console.Out.WriteLine("File was Open\n\tExit and Press Enter to Continue.."); Console.ReadLine(); } } }
static void Main(string[] args) { Jacobi jacobi = new Jacobi(); while (choice == 1) { List <double> offsets = new List <double>(); List <double> _offsets = new List <double>(); try { String time = DateTime.Now.TimeOfDay.TotalMinutes.ToString(); Console.Out.WriteLine("Current Time of Day is " + DateTime.Now.TimeOfDay); Console.Out.WriteLine("\n<<<Please close the Excel Report before running the Program>>>"); double[,] matrix = new double[5, 5]; Random gen = new Random(); Console.Out.Write("\n\t"); for (byte i = 0; i < matrix.GetLength(0); ++i) { for (byte j = 0; j < matrix.GetLength(1); ++j) { matrix[i, j] = matrix[j, i] = gen.NextDouble() * 100; } } // double[,] matrix = { { 2, 1, 1 }, { 1, 2, 1 }, { 1, 1, 2 } }; double[,] originalMatrix = matrix; offsets.Add(jacobi.off(matrix)); _offsets.Add(jacobi.off(matrix)); offsets.AddRange(jacobi.run(ref matrix, 1)); Console.Out.WriteLine("\n\n"); generateReport(offsets, originalMatrix, matrix, 1); matrix = originalMatrix; _offsets.AddRange(jacobi.run(ref matrix, 2)); generateReport(_offsets, originalMatrix, matrix, 2); Console.Out.WriteLine("\n\nNumber of Iterations: \n\tWith Sorting: " + offsets.Count + "\n\tWithout Sorting: " + _offsets.Count); System.Diagnostics.Process.Start("Report.xlsx"); Console.Out.WriteLine("\n01: Run Again\n02: Exit"); choice = Int32.Parse(Console.ReadLine()); Console.Clear(); } catch (IOException) { Console.Clear(); Console.Out.WriteLine("File was Open\n\tExit and Press Enter to Continue.."); Console.ReadLine(); } } }