[Numpy-discussion] cross product of two vectors as sets

Uwe Schmitt rocksportrocker@googlemail....
Thu Sep 11 07:32:35 CDT 2008


Hi,

I want to calculate the crossproduct (from set theory, not vectorspace
crossproduct) of two vectors x,y.
My method is as follows:

>>> x = array([1,2,3])
>>> y = array([4,5])

>>> xx, yy = meshgrid(x,y)
>>> array(zip(xx.flatten(), yy.flatten()))

array([[1, 4],
         [2, 4],
         [3, 4],
         [1, 5],
         [2, 5],
         [3, 5]])

I guess there is an easier way to achieve this. Any hints ?

Greetings, Uwe


More information about the Numpy-discussion mailing list