Пример #1
0
        public void USolveExeptions()
        {
            _matrix = new double[][] { new double[] { 1 },
                                       new double[] { 2, 5 },
                                       new double[] { 2, 5, 4 } };
            SymmetricDenseMatrix denseSymmetricMatrix = new SymmetricDenseMatrix(_matrix);

            Vector exampleVector = new Vector(new double[2] {
                1.0, 2.0
            });

            Assert.Throws <ArgumentNullException>(() => denseSymmetricMatrix.USolve(null, false));
            Assert.Throws <RankException>(() => denseSymmetricMatrix.USolve(exampleVector, false));
        }
Пример #2
0
        public void USolve()
        {
            _matrix = new double[][] { new double[] { 1 },
                                       new double[] { 2, 5 },
                                       new double[] { 2, 5, 4 } };
            SymmetricDenseMatrix denseSymmetricMatrix = new SymmetricDenseMatrix(_matrix);

            Vector vector = new Vector(new double[] { 1, 0, -0.04301075 });

            var    result       = denseSymmetricMatrix.USolve(vector, false);
            Vector resultActual = new Vector(new double[] { 0.655914, 0.21505375, -0.04301075 });


            for (int i = 0; i < result.Size; i++)
            {
                Assert.Equal(result[i], resultActual[i], 8);
            }
        }