private void GausMethod() { Determinant.CreateDetTable(table); gausTable = Determinant.GetTable; gausSolution = new double[rowCount]; lineSolution.CopyTo(gausSolution, 0); HistoryParsing(Determinant.GetHistoryChangeTable); string ans = ""; for (int i = rowCount - 1; i >= 0; i--) { ans = ans.Insert(0, $"\n\t\t{i+1} = {Math.Round(gausSolution[i]/gausTable[i,i])};"); } answerGaus += ans; det = Determinant.GetDeterminant; }
private void KramerMethod() { if (det != 0) { for (int i = 0; i < rowCount; i++) { double[,] tb = (double[, ])table.Clone(); for (int j = 0; j < rowCount; j++) { tb[j, i] = lineSolution[j]; } Determinant.CreateDetTable(tb); answerKramer += $"\n\t\t{i + 1} = {Math.Round(Determinant.GetDeterminant / det, eps)}; "; } } else { throw new Exception("<KramerMethod>\n\tDeterminant is 0"); } }
//Конструктор для квадратных матриц public MatrixClass(int _size, double[,] value, double[] _lineSolution = null) { rowCount = _size; columnCount = _size; size = $"{_size}x{_size}"; if (_lineSolution != null) { lineSolution = (double[])_lineSolution.Clone(); } table = (double[, ])value.Clone(); TranspositionMatrix(); Determinant.CreateDetTable(table); det = Determinant.GetDeterminant; if (det != 0) { InverseMatrix(); } }