This task is similar to:

   Matrix multiplication
   Matrix transposition


Task

Implement basic element-wise matrix-matrix and scalar-matrix operations, which can be referred to in other, higher-order tasks.

Implement:

   addition
   subtraction
   multiplication
   division
   exponentiation


Extend the task if necessary to include additional basic operations, which should not require their own specialised task.




# create a 2-times-2 matrix
mat <- matrix(1:4, 2, 2)
 
# matrix with scalar
mat + 2
mat * 2
mat ^ 2
 
# matrix with matrix
mat + mat
mat * mat
mat ^ mat