Numpy: multiply, matmul, dot for vector and matrix



examples/numpy/multiply_matrix_and_vector.py
import numpy as np

a = np.array([[1, 2, 3], [4, 5, 6]])
b = np.array([1, 2, 4])
print(a)
print(b)
print()

print(a*b)
print(b*a)
print()

print(np.multiply(a, b))

print()
print( np.dot(a, b) )
print( np.matmul(a, b) )

[[1 2 3]
 [4 5 6]]
[1 2 4]

[[ 1  4 12]
 [ 4 10 24]]
[[ 1  4 12]
 [ 4 10 24]]

[[ 1  4 12]
 [ 4 10 24]]

[17 38]
[17 38]