我现在有两个向量的形状(300L,)每个。但是,当我试图通过numpy cross function计算它们之间的叉积时,会抛出以下错误:
z = np.cross(x,y)
C:\Users\SMG059\AppData\Local\Continuum\Anaconda\lib\site-packages\numpy\core\numeric.pyc in cross(a, b, axisa, axisb, axisc, axis) 1525 "(dimension must be 2 or 3)") 1526 if a.shape[-1] not in (2, 3) or b.shape[-1] not in (2, 3): -> 1527 raise ValueError(msg) 1528 1529 # Create the output array
ValueError: incompatible dimensions for cross product (dimension must be 2 or 3)
有人能告诉我如何计算大向量的叉积吗?在
根据你关于想知道数组之间的角度的评论,我认为你确实想要点积。例如,这里有一个函数,它可以给出两个向量之间的夹角。在
相关问题 更多 >
编程相关推荐