[Numpy-discussion] Tuple outer product?

Mads Ipsen mpi@comxnet...
Sat Sep 26 03:50:54 CDT 2009


Robert Kern wrote:
> On Fri, Sep 25, 2009 at 17:38, Mads Ipsen <mpi@comxnet.dk> wrote:
>   
>> Yes, but it should also work for [2.1,3.2,4.5] combined with
>> [4.6,-2.3,5.6] - forgot to tell that.
>>     
>
> In [5]: np.transpose(np.meshgrid([2.1,3.2,4.5], [4.6,-2.3,5.6]))
> Out[5]:
> array([[[ 2.1,  4.6],
>         [ 2.1, -2.3],
>         [ 2.1,  5.6]],
>
>        [[ 3.2,  4.6],
>         [ 3.2, -2.3],
>         [ 3.2,  5.6]],
>
>        [[ 4.5,  4.6],
>         [ 4.5, -2.3],
>         [ 4.5,  5.6]]])
>
>   
Point taken :-)

-- 
+------------------------------------------------------------+
| Mads Ipsen, Scientific developer                           |
+------------------------------+-----------------------------+
| QuantumWise A/S              | phone:         +45-29716388 |
| Nørresøgade 27A              | www:    www.quantumwise.com |
| DK-1370 Copenhagen, Denmark  | email:  mpi@quantumwise.com |
+------------------------------+-----------------------------+




More information about the NumPy-Discussion mailing list