I am trying to create a new matrix(array)
a = [1, 2, 3] b = [0, 1, 2]
where
C = [[1*0, 1*1, 1*2], [2*0, 2*1, 2*2], [3*0, 3*1, 3*2]]
I have been scouring the documentation in numpy but can’t find a function to satisfy this.
for i in a: c = np.multiply(a, b) for j in b: c = np.multiply(a, b)
Advertisement
Answer
You’re looking for numpy.matmul
. You’ll need to make the vectors have two dimensions (with a size of one in one of the dimensions). For example:
np.matmul(np.array([[1],[2],[3]]), np.array([[2,3,4]]))