When I multiply two numpy
arrays of sizes (n x n)*(n x 1), I get a matrix of size (n x n). Following normal matrix multiplication rules, an (n x 1) vector is expected, but I simply cannot find any information about how this is done in Python’s Numpy module.
The thing is that I don’t want to implement it manually to preserve the speed of the program.
Example code is shown below:
a = np.array([[5, 1, 3], [1, 1, 1], [1, 2, 1]])
b = np.array([1, 2, 3])
print a*b
>>
[[5 2 9]
[1 2 3]
[1 4 3]]
What I want is:
print a*b
>>
[16 6 8]