# Multiplication

This type of multiplication is different from Matrix Multiplication in that the multiplication is performed on each pair of corresponding elements.

Each index of the first matrix is multiplied by the same index of the second matrix, with the product, and put into a new matrix in the same position. Only matrices with the same dimensions can be multiplied this way.

.* | Scalar | Row Vector | Column Vector | Matrix |
---|---|---|---|---|

Scalar | Multiplies the two scalar values. | Multiplies the scalar with each element in the row vector. | Multiplies the scalar with each element in the column vector. The resulting vector is the same size as the original vector. | Multiplies the scalar with each element in the matrix. The resulting vector is the same size as the original matrix. |

Row Vector | Multiplies the scalar with each element in the row vector. The resulting vector is the same size as the original vector. | Requires the vectors to be the same size. Multiples each entity of the first vector and with the corresponding entity of the second vector. The resulting vector is the same size as the original vectors. | Each row/column vector is implicitly replicated until the two arguments have the same dimensions. Regular multiplication is then performed. | The row vector is implicitly replicated until the two arguments have the same number of rows. Regular multiplication is then performed. |

Column Vector | Multiplies the scalar with each element in the column vector. The resulting vector is the same size as the original vector. | Each row/column vector is implicitly replicated until the two arguments have the same dimensions. Regular multiplication is then performed. | Requires the vectors to be the same size. Multiples each entity of the first vector and with the corresponding entity of the second vector. The resulting vector is the same size as the original vectors. | The column vector is implicitly replicated until the two arguments have the same number of columns. Regular multiplication is then performed. |

Matrix | Multiplies the scalar with each element in the matrix. The resulting vector is the same size as the original matrix. | The row vector is implicitly replicated until the two arguments have the same number of rows. Regular multiplication is then performed. | The column vector is implicitly replicated until the two arguments have the same number of columns. Regular multiplication is then performed. | Requires the matrices to be the same size. Multiples each entity of the first matrix and with the corresponding entity of the second matrix. The resulting matrix is the same size as the original matrices. |

## Examples

```
3 .* 3
ans = 9
4 .* [5 6 2]
ans = [20 24 8]
[8 6 7] .* [5 3 0]
ans = [40 18 0]
```

`[2 5 1] .* [7; 5; 3; 4]`

## Comments

The implicit replication of a vector to fill other dimensions is a generalization of operating on a scalar/vector pair. This capability is not yet available for multidimensional and sparse matrices.