SystemSolve() public méthode

Solves for the column matrix x, where Ax = b.
public SystemSolve ( Matrix columnMatrix ) : Matrix
columnMatrix Matrix
Résultat Matrix
        public void MatrixTest_SystemSolve_ZeroMatrix()
        {
            //Ax = b
            Matrix matrixA = new Matrix(4, 4);
            Matrix matrixB = new Matrix(4, 1);
                                 
            //Solve for x
            Matrix expectedResultMatrix = new Matrix(4, 1);
            
            Matrix actualResultMatrix = matrixA.SystemSolve(matrixB);

            actualResultMatrix.Should().Be(expectedResultMatrix);
        }
        public void Matrix_SystemSolveStandardTest()
        {
            //Ax = b
            Matrix matrixA = new Matrix(4, 4);
            Matrix matrixB = new Matrix(4, 1);

            //Set up matrix A
            double[] columnOneOfMatrixA = { 3, 1, 2, 5 };
            double[] columnTwoOfMatrixA = { 7, 8, 1, 4 };
            double[] columnThreeOfMatrixA = { 2, 4, 9, 7 };
            double[] columnFourOfMatrixA = { 5, 2, 3, 1 };

            matrixA.SetColumn(0, columnOneOfMatrixA);
            matrixA.SetColumn(1, columnTwoOfMatrixA);
            matrixA.SetColumn(2, columnThreeOfMatrixA);
            matrixA.SetColumn(3, columnFourOfMatrixA);

            //Set up matrix b
            double[] bColumn = { 49, 30, 43, 52 };
            matrixB.SetColumn(0, bColumn);            

            //Solve for x
            Matrix expectedResultMatrix = new Matrix(4, 1);
            double[] expectedResult = { 6, 1, 2, 4 };
            expectedResultMatrix.SetColumn(0, expectedResult);

            Matrix actualResultMatrix = matrixA.SystemSolve(matrixB);

            double tolerance = .001;
            Matrix differenceMatrix = expectedResultMatrix - actualResultMatrix;

            for (int i = 0; i < differenceMatrix.NumberOfRows; i++)
            {
                for (int j = 0; j < differenceMatrix.NumberOfColumns; j++)
                {
                    (Math.Abs(differenceMatrix.GetElement(i, j)) < tolerance).Should().BeTrue();
                }
            }

            
        }