public SquareMatrix <int> AddDiagonalMatrixPlusSymetricMatrixTest(int[,] arr1, int[,] arr2) { var lhs = new DiagonalMatrix <int>(arr1); var rhs = new SymmetricMatrix <int>(arr1); return(MatrixExtension.Add(lhs, rhs)); }
public SquareMatrix <int> AddSquaresMatrixTest(int[,] arr1, int[,] arr2) { var lhs = new SquareMatrix <int>(arr1); var rhs = new SquareMatrix <int>(arr1); return(MatrixExtension.Add(lhs, rhs)); }
public void MatrixHierarchyAdditionTest2() { var array1 = new string[][] { new string[] { "-3" }, new string[] { "6", "-5" }, new string[] { "5", "7", "4" } }; var array2 = new string[] { "ab", "cd", "ef" }; var resultArray = new string[, ] { { "-3ab", "6", "5" }, { "6", "-5cd", "7" }, { "5", "7", "4ef" } }; var matrixA = new SymmetricalMatrix <string>(array1); var matrixB = new DiagonalMatrix <string>(array2); var sum = MatrixExtension <string> .Add(matrixA, matrixB); CollectionAssert.AreEqual(resultArray, sum.ToArray()); }
public void MatrixHierarchyAdditionTest1() { var array1 = new int[, ] { { 5, 6, -3 }, { 17, 7, 0 }, { 8, -5, 4 } }; var array2 = new int[, ] { { 2, 3, 0 }, { 6, 11, 1 }, { 3, 3, 7 } }; var resultArray = new int[, ] { { 7, 9, -3 }, { 23, 18, 1 }, { 11, -2, 11 } }; var matrixA = new SquareMatrix <int>(array1); var matrixB = new SquareMatrix <int>(array2); var sum = MatrixExtension <int> .Add(matrixA, matrixB); CollectionAssert.AreEqual(resultArray, sum.ToArray()); }