n = 100

nsq = n * n

# generate two random matrices

a = matrix(runif(nsq), nrow = n, ncol = n)

b = matrix(runif(nsq), nrow = n, ncol = n)

system.time(a %*% b) # built-in matrix multiplication

matMult = function(a, b, n) {

m = matrix(data = 0, nrow = n, ncol = n)