コード例 #1
0
        public void GetMatrixReturnsDenseMatrixOfExpectedSizeIfCoefficientsMissing()
        {
            var equations = new List<Equation>
            {
                new Equation("2x+y=3"),
                new Equation("y=4")
            };
            var equationsSystem = new EquationsSystem(equations);
            var expectedMatrix = DenseMatrix.OfArray(new double[,]
            {
                {2,1},
                {0,1}
            });

            var equationMatrix = equationsSystem.GetMatrix();

            Assert.Equal(expectedMatrix, equationMatrix);
        }
コード例 #2
0
        public void GetMatrixReturnsDenseMatrixOfExpectedSizeIfCoefficientsMissing()
        {
            var equations = new List <Equation>
            {
                new Equation("2x+y=3"),
                new Equation("y=4")
            };
            var equationsSystem = new EquationsSystem(equations);
            var expectedMatrix  = DenseMatrix.OfArray(new double[, ]
            {
                { 2, 1 },
                { 0, 1 }
            });

            var equationMatrix = equationsSystem.GetMatrix();

            Assert.Equal(expectedMatrix, equationMatrix);
        }
コード例 #3
0
        public void GetMatrixReturnsDenseMatrixOfExpectedSize()
        {
            var equations = new List <Equation>
            {
                new Equation("3x+2y-5z=2"),
                new Equation("5x+3y-8z=7"),
                new Equation("6x+8y-3z=1")
            };
            var equationsSystem = new EquationsSystem(equations);
            var expectedMatrix  = DenseMatrix.OfArray(new double[, ]
            {
                { 3, 2, -5 },
                { 5, 3, -8 },
                { 6, 8, -3 }
            });

            var equationMatrix = equationsSystem.GetMatrix();

            Assert.Equal(expectedMatrix, equationMatrix);
        }
コード例 #4
0
        public void GetMatrixReturnsDenseMatrixOfExpectedSize()
        {
            var equations = new List<Equation>
            {
                new Equation("3x+2y-5z=2"),
                new Equation("5x+3y-8z=7"),
                new Equation("6x+8y-3z=1")
            };
            var equationsSystem = new EquationsSystem(equations);
            var expectedMatrix = DenseMatrix.OfArray(new double[,]
            {
                {3,2,-5},
                {5,3,-8},
                {6,8,-3}
            });

            var equationMatrix = equationsSystem.GetMatrix();

            Assert.Equal(expectedMatrix, equationMatrix);
        }