There are different kinds of operations which can be performed on matrices.

**Elementwise addition**: Given two matrices, a and b, addition of the two (a + b) means adding each element of two matrices.

Breeze

val a = DenseMatrix((1,2),(3,4)) val b = DenseMatrix((2,2),(2,2)) val c = a + b println("a: n" + a) println("b: n" + b) println("a + b : n" + c)

The output of the last code is given as follows:

a:1 23 4b:2 22 2a + b :3 45 6

**Elementwise multiplication**: In this operation, each element of the matrix*a*is multiplied by matrix

Breeze

a :* b val d = a*b println("Dot product a*b : n" + d)

The output of the preceding code is given as follows:

Dot product a*b :6 6 ...