public static async Task WriteSizeInfoToFile(string path, GaussMethod gauss) { try { using (StreamWriter writer = new StreamWriter(path, false, Encoding.UTF8)) { await writer.WriteLineAsync(gauss.rowCount + "x" + gauss.columCount); } } catch (Exception e) { Console.WriteLine(e.Message); } }
private void btn_solve_Click(object sender, EventArgs e) { const int number = 10000; int size = Convert.ToInt16(number_of_equals.Value); GaussMethod G = new GaussMethod(size, size); try { for (int i = 0; i < size; i++) for (int j = 0; j < size; j++) G.Matrix[i, j] = Convert.ToDouble(matrix[j, i].Value); for (int i = 0; i < size; i++) G.RightPart[i] = Convert.ToDouble(vector[0, i].Value); } catch { MessageBox.Show("Incorrect input", "Error"); return; } System.Diagnostics.Stopwatch time = new System.Diagnostics.Stopwatch(); time.Start(); for (int m = 0; m < number; m++) { if (G.SolveMatrix()) { for (int i = 0; i < size; i++) for (int j = 0; j < size; j++) solution[0, i].Value = G.Answer[i]; if (fixed_matrix.Checked) { for (int j = 0; j < size; j++) for (int k = 0; k < size; k++) matrix[j, k].Value = G.Matrix[k, j]; } // MessageBox.Show("Solution taken " + time.ElapsedMilliseconds + " ms", "Performance"); } } time.Stop(); timer.Text = "Solved for " + Convert.ToString(time.ElapsedMilliseconds) + " ms"; MessageBox.Show("Solution taken " + time.ElapsedMilliseconds + " ms" + " for " + number + " iterations", "Performance"); // else // MessageBox.Show("System is incompatible", "Error"); }