Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 numpy 中,我们可以在两个向量之间执行“外加” a,b如下所示:
a
b
a=np.c_[1,2,3] b=np.c_[4,5,6] result=a+b.T # alternatively this can be a.T+b
可以einsum用来做同样的计算吗?还有其他快速的选择吗?如果a等于b呢?
einsum
此操作的另一种快速替代方法是使用:
np.add.outer(a,b)