Added map function

Map function is applied to every element of the matrix. Changed the multiply
method to use the new map function.