[Numpy-discussion] array of matrices
Robert Kern
robert.kern@gmail....
Sat Mar 28 02:47:09 CDT 2009
2009/3/27 Charles R Harris <charlesr.harris@gmail.com>:
>
> On Fri, Mar 27, 2009 at 4:43 PM, Robert Kern <robert.kern@gmail.com> wrote:
>>
>> On Fri, Mar 27, 2009 at 17:38, Bryan Cole <bryan@cole.uklinux.net> wrote:
>> > I have a number of arrays of shape (N,4,4). I need to perform a
>> > vectorised matrix-multiplication between pairs of them I.e.
>> > matrix-multiplication rules for the last two dimensions, usual
>> > element-wise rule for the 1st dimension (of length N).
>> >
>> > (How) is this possible with numpy?
>>
>> dot(a,b) was specifically designed for this use case.
>
> I think maybe he wants to treat them as stacked matrices.
Oh, right. Sorry. dot(a, b) works when a is (N, 4, 4) and b is just
(4, 4). Never mind.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the Numpy-discussion
mailing list