Skip to main content

Matrices

Geoffrey Hunter
mbedded.ninja Author
warning
This page is in notes format, and may not be of the same quality as other pages on this site.

Dot Product

Numpy

The dot product of arrays of vectors can be calculated using Numpy with:

import numpy as np
a = np.array([[1, 1, 1], [2, 2, 2]])
b = np.array([[1, 2, 3], [4, 5, 6]])
np.sum(a*b, axis=1)

Projection

The dot product can be used to calculate the projection of a vector onto an axis in 3D space.