Accord.Tests.Math.QrDecompositionTest.QrDecompositionConstructorTest C# (CSharp) Method

QrDecompositionConstructorTest() private method

private QrDecompositionConstructorTest ( ) : void
return void
        public void QrDecompositionConstructorTest()
        {
            double[,] value =
            {
               {  2, -1,  0 },
               { -1,  2, -1 },
               {  0, -1,  2 }
            };


            var target = new QrDecomposition(value);

            // Decomposition Identity
            var Q = target.OrthogonalFactor;
            var QQt = Matrix.Multiply(Q, Q.Transpose());
            Assert.IsTrue(Matrix.IsEqual(QQt, Matrix.Identity(3), 1e-6));
            Assert.IsTrue(Matrix.IsEqual(value, target.Reverse(), 1e-6));


            // Linear system solving
            double[,] B = Matrix.ColumnVector(new double[] { 1, 2, 3 });
            double[,] expected = Matrix.ColumnVector(new double[] { 2.5, 4.0, 3.5 });
            double[,] actual = target.Solve(B);

            Assert.IsTrue(Matrix.IsEqual(expected, actual, 0.0000000000001));
        }