## Some E5 Test Cases with the correct output. # Make your own test cases as well, and put them in a separate R script. # Do not submit your test cases. > M <- matrix(c(1,2,3,4,5,6,7,8,9), nrow=3, ncol=3) > M [,1] [,2] [,3] [1,] 1 4 7 [2,] 2 5 8 [3,] 3 6 9 > > DiagonalSum(M, 8) [1] TRUE > DiagonalSum(M, 17) [1] FALSE > > MatrixMultiples(M, 2) [[1]] [1] 1 2 [[2]] [1] 2 1 [[3]] [1] 2 3 [[4]] [1] 3 2 > MatrixMultiples(M, 3) [[1]] [1] 3 1 [[2]] [1] 3 2 [[3]] [1] 3 3 > > EdgeSums(M) [,1] [,2] [,3] [1,] 1 4 7 [2,] 2 40 8 [3,] 3 6 9 > > A <- matrix(1, nrow=5, ncol=5) > A [,1] [,2] [,3] [,4] [,5] [1,] 1 1 1 1 1 [2,] 1 1 1 1 1 [3,] 1 1 1 1 1 [4,] 1 1 1 1 1 [5,] 1 1 1 1 1 > > EdgeSums(A) [,1] [,2] [,3] [,4] [,5] [1,] 1 1 1 1 1 [2,] 1 1 1 1 1 [3,] 1 1 16 1 1 [4,] 1 1 1 1 1 [5,] 1 1 1 1 1 > > > SumReplace(M) [,1] [,2] [,3] [1,] 1 8 7 [2,] 2 10 8 [3,] 3 12 9 > > SumReplace(A) [,1] [,2] [,3] [,4] [,5] [1,] 1 2 1 2 1 [2,] 1 2 1 2 1 [3,] 1 2 1 2 1 [4,] 1 2 1 2 1 [5,] 1 2 1 2 1 > > Z <- matrix(1, nrow=4, ncol=4) > Z [,1] [,2] [,3] [,4] [1,] 1 1 1 1 [2,] 1 1 1 1 [3,] 1 1 1 1 [4,] 1 1 1 1 > SumReplace(Z) [,1] [,2] [,3] [,4] [1,] 1 2 1 1 [2,] 1 2 1 1 [3,] 1 2 1 1 [4,] 1 2 1 1