static double[][] TimeProblem(ProblemInfo info, IMatrix A, double[] b) { ISolver solver = new LOSLU(); LSlaeBuilder tsb = new LSlaeBuilder(info); double[] t = info.TimeMesh; double[][] Q = new double[info.TimeMesh.Length][]; Q[0] = new double[A.N]; for (int i = 0; i < A.N; i++) { Q[0][i] = 25.0; } tsb.Layer = new TwoLayer(); tsb.Layer.SetQ(new double[1][] { Q[0] }); tsb.Layer.SetT(new double[] { t[0], t[1] }); tsb.CurrentT = info.TimeMesh[1]; tsb.Build(A, b); Q[1] = solver.Solve(A, b); ClearMatrix(A, b); tsb.Layer = new ThreeLayer(); tsb.Layer.SetQ(new double[2][] { Q[0], Q[1] }); tsb.Layer.SetT(new double[3] { t[0], t[1], t[2] }); tsb.CurrentT = t[2]; tsb.Build(A, b); Q[2] = solver.Solve(A, b); ClearMatrix(A, b); tsb.Layer = new FourLayer(); tsb.Layer.SetQ(new double[3][] { Q[0], Q[1], Q[2] }); tsb.Layer.SetT(new double[4] { t[0], t[1], t[2], t[3] }); tsb.CurrentT = t[3]; tsb.Build(A, b); Q[3] = solver.Solve(A, b); ClearMatrix(A, b); for (int i = 4; i < info.TimeMesh.Length; i++) { tsb.Layer.SetQ(new double[3][] { Q[i - 3], Q[i - 2], Q[i - 1] }); tsb.Layer.SetT(new double[4] { t[i - 3], t[i - 2], t[i - 1], t[i] }); tsb.CurrentT = t[i]; tsb.Build(A, b); Q[i] = solver.Solve(A, b); Console.WriteLine($"Невязка = {solver.Difference:E4}"); ClearMatrix(A, b); } return(Q); }
static void Problem(ProblemInfo info, IMatrix A, double[] b) { LSlaeBuilder builder = new LSlaeBuilder(info); builder.Build(A, b); ISolver solver = new LOSLU(); double[] q = solver.Solve(A, b); }