[Numpy-discussion] kind of a matrix multiplication

Martin Raspaud martin.raspaud at smhi.se
Tue Oct 11 05:48:51 EDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 11/10/11 07:49, Martin Raspaud wrote:
> Hi all,
[...]
> I'm looking for the operation needed to get the two (stacked) vectors
> array([[0, 1, 2],
>        [6, 8, 10]]))
> or its transpose.

Hi again,

Here is a solution I just found:
np.einsum("ik, jki->ij", stack, mat)
array([[  0.,   1.,   2.],
       [  6.,   8.,  10.]])


Best regards,
Martin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Red Hat - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOlBEDAAoJEBdvyODiyJI4DTQH/ikl8Rb1Lx5qakyS4IoXcBos
lPyKk7s+AEA6dthxDJP+O5v+YQsMxR1f5Swx1rJ2OJxjmJ/6Rb8yphMMdX89kgkL
VhMIpDwre8/KyReTl1CT2chWtOtz8B46Pn1ivhDbNfvCUBc39v2ymJXV2bZCYzBD
fn1phhoYgmo3zsnnj3w6CSjAjsJmaI4+OuLAsd2IXWUmN8/CmwwAIBL9tlzrhmBR
n5N1gEq9YV7LYgxjeoG47NkbLe0GbLTVWUb7H5/3GvoXh6bKtrujtPeWaMTVLeIo
q/n8Cg8977WSpR1W1soBEMf/nCdLs7IeqlN7utjOTI33UOo07hssb+xtfwv2By8=
=UU5t
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: martin_raspaud.vcf
Type: text/x-vcard
Size: 293 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20111011/84d50d13/attachment.vcf>


More information about the NumPy-Discussion mailing list