Hadamard product: hadamard product .*

### 5.45.8 Hadamard product: hadamard product .*

The hadamard command can find the Hadamard product of two matrices; namely, the term-by-term product of the two matrices.
The product command can do the same thing (see also Section 5.40.28 for other uses of product).

- hadamard takes two arguments:
  A and B, two matrices of the same size.
- hadamard(A,B) returns the matrix where each element is the product of the corresponding elements of A and B.

The infixed operator .* also finds the Hadamard product, and also works on lists.

#### Examples.

- Input:
  hadamard([[1, 2],[3,4]],[[5, 6],[7, 8]])
  or:
  hadamard([[1, 2],[3,4]],[[5, 6],[7, 8]])
  or:
  [[1, 2],[3,4]] .* [[5, 6],[7, 8]]
  Output:

  ⎛ ⎜ ⎝ |
  5 | 12
  21 | 32
  | ⎞ ⎟ ⎠

- Input:
  [1,2,3,4] .* [5,6,7,8]
  Output:

  ⎡ ⎣ | 5,12,21,32 | ⎤ ⎦