Пример #1
0
        //From Wiki
        static void Example3()
        {
            ConjugateGradientMatrixSolver solver = new ConjugateGradientMatrixSolver();
            Matrix A = new Matrix(2, 2, new double[] {
                4, 1,
                1, 3
            });

            Vector b = new Vector(new double[] { 1, 2 });
            Vector x = new Vector(new double[] { 2, 1 });


            Vector res = solver.Solve(A, b, x);
        }
Пример #2
0
        static void Example1()
        {
            ConjugateGradientMatrixSolver solver = new ConjugateGradientMatrixSolver();
            Matrix A = new Matrix(3, 3, new double[] {
                4, -1, 1,
                -1, 4, -2,
                1, -2, 4,
            });

            Vector b = new Vector(new double[] { 12, -1, 5 });
            Vector x = new Vector(new double[] { 0, 0, 0 });


            Vector res = solver.Solve(A, b, x);
        }