// матриця А - розмірності m Х n, b - vector of values, lamda - parameter of regularisation public double[] Solve(double lamda) { // solve equation (At*A + lamda*I)*Y = At*b; for (int i = 0; i < n; i++) { At[i, i] += lamda; } //будуємо вектор Ат * b + lamda*Y0 , де Y0 - початкове наближення до розвязку Y // розв`язуємо систему методом Якобі //solution = SystemOfEquations.SolveWithIakobiMethod(At,Atb,0.001); SystemOfLinearEquations systemSolver = new SystemOfLinearEquations(); return(systemSolver.SolveWithQRmethod(At, Atb, Atb.Length)); }
public double[] CalculateDensity() { IntegralEquationDiscretezer discretezer = new IntegralEquationDiscretezer( _state.PointsNumber, _state.DirectProblemCore, _state.RightPartFunction); double[,] matrix; double[] rightPart; discretezer.FormDiscreteEquation(out matrix, out rightPart); SystemOfLinearEquations systemSolver = new SystemOfLinearEquations(); double[] density = systemSolver.LU_methodSolving(matrix, rightPart, rightPart.Length); return(density); }
static void Main(string[] args) { SystemOfLinearEquations a = new SystemOfLinearEquations(); a.SetA(3); a.Setb(); List <double> x = a.GaussMethod(); int i = 1; foreach (double item in x) { Console.WriteLine("x{0}= {1}", i, item); ++i; } Console.ReadKey(); }