作者newmilktea ()
看板Python
标题Re: [问题] 高维矩阵内积
时间Fri Oct 14 16:51:21 2016
这是你要的吗?
a = np.array([[1,2],[3,4],[5,6],[7,8]])
array([[1, 2],
[3, 4],
[5, 6],
[7, 8]])
b = np.array([1,2])
array([1, 2])
np.multiply(a.reshape(2,4).T, b).T.reshape(4,2)
array([[ 1, 2],
[ 3, 4],
[10, 12],
[14, 16]])
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 140.112.41.112
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1476435083.A.3D7.html
1F:推 ice80712: 了解,感谢! 10/15 13:56