python使用中的矩阵乘法*

时间:2015-11-11 23:33:55

标签: python multiplication

我在这里有一些代码:

u = np.zeros((4, 1))
U = np.zeros((4, 4))
# Then did some stuff to change some value in U
X = U * u
print U
print u
print X

输出:

[[ 0. -1.  2.  0.]
[ 0.  0. -1.  3.]
[ 0.  0.  0. -1.]
[ 0.  0.  0.  0.]]
[[ 0.]
 [ 0.]
 [ 0.]
 [ 0.]]
[[ 0. -0.  0.  0.]
 [ 0.  0. -0.  0.]
 [ 0.  0.  0. -0.]
 [ 0.  0.  0.  0.]]

我无法弄清楚。 X不应该是4 * 1矩阵吗?为什么是4 * 4?

0 个答案:

没有答案