Beispiel #1
0
        public void SolverCoreTest2d()
        {
            var a = new double[][] {
                new double[] { 2, 1 },
                new double[] { -1, 1 }
            };
            var b      = new Vector(1, -2);
            var x      = Gauss.SolveCore(a, b);
            var answer = new Vector(1, -1);

            Assert.IsTrue(Vector.GetLInfinityNorm(x, answer) < 1e-10);
        }
Beispiel #2
0
        public void SolverCoreTest3d()
        {
            var a = new double[][] {
                new double[] { 2, 1, -1 },
                new double[] { -3, -1, 2 },
                new double[] { -2, 1, 2 }
            };
            var b      = new Vector(8, -11, -3);
            var x      = Gauss.SolveCore(a, b);
            var answer = new Vector(2, 3, -1);

            Assert.IsTrue(Vector.GetLInfinityNorm(x, answer) < 1e-10);
        }
Beispiel #3
0
 /// <summary>Gaussian elimination method for A*x=b with partial pivoting</summary>
 /// <param name="b">The right hand side vector</param>
 /// <returns>The solution x</returns>
 public Vector SolveGE(Vector b)
 {
     return(Gauss.SolveCore(Copy(), b));
 }