public void Then_inverse(string id, int rows, int cols, DataTable dataTable) { var expectedId = $"inverse({id})"; Given_matrix(expectedId, dataTable); Assert.True(cache[expectedId].Equals(MatrixOperations.Invert(cache[id], MatrixOperation.Cofactor))); Assert.True(cache[expectedId].Equals(MatrixOperations.Invert(cache[id], MatrixOperation.Gauss))); cache.Remove(expectedId); }
public void Then_matrix_inverse_multiply(string c, string b, string a) { // Invert using Cofactor { var actualResult = MatrixOperations.Multiply(cache[c], MatrixOperations.Invert(cache[b], MatrixOperation.Cofactor)); Assert.True(cache[a].Equals(actualResult)); } // Invert using Gauss { var actualResult = MatrixOperations.Multiply(cache[c], MatrixOperations.Invert(cache[b], MatrixOperation.Gauss)); Assert.True(cache[a].Equals(actualResult)); } }
public void MatrixInvertTest1() { var a = MatrixOperations.FromArray(4, 4, new double[]{ -2, -8, 3, 5, -3, 1, 7, 3, 1, 2, -9, 6, -6, 7, 7, -9 }); var a11 = MatrixOperations.Invert(a, MatrixOperation.Gauss); var a12 = MatrixOperations.Invert(a, MatrixOperation.Cofactor); var r1 = MatrixOperations.Multiply(a, a11); var r2 = MatrixOperations.Multiply(a, a12); var i = MatrixOperations.Identity(4); Assert.True(a11.Equals(a12)); Assert.True(i.Equals(r1)); Assert.True(i.Equals(r2)); output.WriteLine(a11.ToString()); }
public void Then_assing_matrix_inverse(string b, string a) { cache[b] = MatrixOperations.Invert(cache[a], MatrixOperation.Cofactor); }
public void Given_inverse(string b, string id) { cache.Add(b, MatrixOperations.Invert(cache[id])); }