public void LUPTest() { var matrix = new Matrix(new[] { new Vector(new[] { new Number(3), new Number(7), new Number(2), new Number(5) }), new Vector(new[] { new Number(1), new Number(8), new Number(4), new Number(2) }), new Vector(new[] { new Number(2), new Number(1), new Number(9), new Number(3) }), new Vector(new[] { new Number(5), new Number(4), new Number(7), new Number(1) }) }); var expected = new Matrix(new[] { new Vector(new[] { new Number(5), new Number(4), new Number(7), new Number(1) }), new Vector(new[] { new Number(0.2), new Number(7.2), new Number(2.6), new Number(1.8) }), new Vector(new[] { new Number(0.4), new Number(-0.0833333333333333), new Number(6.41666666666667), new Number(2.75) }), new Vector(new[] { new Number(0.6), new Number(0.638888888888889), new Number(-0.601731601731602), new Number(4.90476190476191) }) }); int[] perm; int toggle; var actual = MatrixExtensions.LUPDecomposition(matrix, null, out perm, out toggle); Assert.Equal(expected, actual); }