# Convert math equations to numpy

** Published:**

This is a memo for coding matrix operations in numpy.

## Hadamard product

```
A*B
```

## Matrix multiplication

```
np.dot(A, B)
np.matmul(A, B)
A @ B
```

## Outer product

```
np.outer(A, B)
```

## Kronecker product

```
np.kron(A, B)
```

if `a`

and `b`

are vectors, the Kronecker product is a form of vectorization (or flattening) of the outer product of `a`

and `b`

.

```
np.kron(a, b) == np.outer(a, b).reshape(-1)
```

*All images are retrieved from Wikipedia*.