> > On Thu, Oct 26, 2017 at 12:11 PM, Daniele Nicolodi
> > wrote:
> >
> >> is there a better way to write the dot product between a stack of
> >> matrices? In my case I need to compute
> >>
> >> y = A.T @ inv(B) @ A
> >>
> >> with A a 3x1 matrix and B a 3x3 matrix, N times, with N in the few
> >>
I would certainly use einsum. It is almost perfect for these use cases,
e.g.,
np.einsum('ki,kij,kj->k', A, inv(B), A)
On Thu, Oct 26, 2017 at 12:38 PM Charles R Harris
wrote:
> On Thu, Oct 26, 2017 at 12:11 PM, Daniele Nicolodi
> wrote:
>
>> Hello,
>>
>> is there a better way to write the dot p
On Thu, Oct 26, 2017 at 12:11 PM, Daniele Nicolodi
wrote:
> Hello,
>
> is there a better way to write the dot product between a stack of
> matrices? In my case I need to compute
>
> y = A.T @ inv(B) @ A
>
> with A a 3x1 matrix and B a 3x3 matrix, N times, with N in the few
> hundred thousands ra
Hello,
is there a better way to write the dot product between a stack of
matrices? In my case I need to compute
y = A.T @ inv(B) @ A
with A a 3x1 matrix and B a 3x3 matrix, N times, with N in the few
hundred thousands range. I thus "vectorize" the thing using stack of
matrices, so that A is a