[Numpy-discussion] Apply transform to many small matrices
Jaime Fernández del Río
jaime.frio@gmail....
Wed Feb 27 09:18:59 CST 2013
On Wed, Feb 27, 2013 at 5:41 AM, Jorge Scandaliaris
<jorgesmbox-ml@yahoo.es>wrote:
> Jorge Scandaliaris <jorgesmbox-ml <at> yahoo.es> writes:
> > I have an ndarray A of shape (M,2,2) representing M 2 x 2 matrices.
> > Now I want to apply a transform T of shape (2,2) to each of matrix.
>
np.einsum makes a lot of these easier to figure out:
In [7]: np.einsum('ijk, kl', A, T)
Out[7]:
array([[[ 7, 10],
[15, 22]],
[[23, 34],
[31, 46]],
[[39, 58],
[47, 70]]])
Jaime
--
(\__/)
( O.o)
( > <) Este es Conejo. Copia a Conejo en tu firma y ayúdale en sus planes
de dominación mundial.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20130227/eb365b8b/attachment.html
More information about the NumPy-Discussion
mailing list