public void MatrixCramersRuleValidResult() { var values = new double[, ] { { 8, -1, -2 }, { -1, 7, -1 }, { -2, -1, 9 } }; var result = new MatrixNxN <double>(values).CramersRule(new List <double> { 0, 10, 23 }); var expectedResult = new List <double> { 1, 2, 3 }; Assert.IsTrue(result.SequenceEqual(expectedResult, NumericUtilities.FloatNumberEqualityComparer <double>())); }
public void MatrixDivision() { var values1 = new double[, ] { { 1, 2, 3 }, { 5, 6, 7 }, { 0, 0, 0 } }; var values2 = new double[, ] { { -7, -9, 11 }, { 10, -14, -5 }, { 4, -10, 10 } }; var expectedValues = new double[, ] { { -281 / 963.0, -283 / 963.0, 913 / 1926.0 }, { -989 / 963.0, -763 / 963.0, 2761 / 1926.0 }, { 0, 0, 0 } }; var result = new MatrixNxN <double>(values1) / new MatrixNxN <double>(values2); Assert.IsTrue(result.SequenceEqual(Enumerable.Cast <double>(expectedValues), NumericUtilities.FloatNumberEqualityComparer <double>())); }