public void MinorArbitraryInterface() { IMathematicalMatrix matrix = MatrixTest.GetTestMatrix(); var rows = matrix.Rows; var columns = matrix.Columns; var minor = matrix.Minor(2, 3); Assert.AreEqual(minor.Columns, columns - 1); Assert.AreEqual(minor.Rows, rows - 1); for (var i = 0; i < minor.Rows; i++) { for (var j = 0; j < minor.Columns; j++) { var addAmount = 0; if (i >= 2) { addAmount++; } if (j >= 3) { addAmount++; } Assert.AreEqual(minor[i, j], i + j + addAmount); } } Assert.IsTrue(MatrixTest.IsOriginalTestMatrix(matrix)); }
public void BottomRight() { var matrix = MatrixTest.GetTestMatrix(); var rows = matrix.Rows; var columns = matrix.Columns; var minor = matrix.Minor(matrix.Rows - 1, matrix.Columns - 1); Assert.AreEqual(minor.Columns, columns - 1); Assert.AreEqual(minor.Rows, rows - 1); for (var i = 0; i < minor.Rows; i++) { for (var j = 0; j < minor.Columns; j++) { Assert.AreEqual(minor[i, j], i + j); } } Assert.IsTrue(MatrixTest.IsOriginalTestMatrix(matrix)); }
public void MinorBottomLeftInterface() { IMathematicalMatrix matrix = MatrixTest.GetTestMatrix(); var rows = matrix.Rows; var columns = matrix.Columns; var minor = matrix.Minor(matrix.Rows - 1, 0); Assert.AreEqual(minor.Columns, columns - 1); Assert.AreEqual(minor.Rows, rows - 1); for (var i = 0; i < minor.Rows; i++) { for (var j = 0; j < minor.Columns; j++) { Assert.AreEqual(minor[i, j], i + j + 1); } } Assert.IsTrue(MatrixTest.IsOriginalTestMatrix(matrix)); }