public void Matrix_ExtractUpperComplicatedTest() { Matrix matrixA = new Matrix(4, 4); //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); //The LUP Decomposition //Correct U Part Matrix correctUPartOfLUPDecomposition = new Matrix(4, 4); double[] columnOneOfUMatrix = { 3, 0, 0, 0 }; double[] columnTwoOfUMatrix = { 7, 8, 0, 0 }; double[] columnThreeOfUMatrix = { 2, 4, 9, 0 }; double[] columnFourOfUMatrix = { 5, 2, 3, 1 }; correctUPartOfLUPDecomposition.SetColumn(0, columnOneOfUMatrix); correctUPartOfLUPDecomposition.SetColumn(1, columnTwoOfUMatrix); correctUPartOfLUPDecomposition.SetColumn(2, columnThreeOfUMatrix); correctUPartOfLUPDecomposition.SetColumn(3, columnFourOfUMatrix); //Calculate U Part Matrix calculatedUPartOfLUPDecomposition = matrixA.ExtractUpper(); (calculatedUPartOfLUPDecomposition == correctUPartOfLUPDecomposition).Should().BeTrue(); }