# [Numpy-discussion] sum of outer products

Pauli Virtanen pav@iki...
Mon Sep 20 16:49:23 CDT 2010

Mon, 20 Sep 2010 23:34:58 +0200, Hagen Fürstenau wrote:
> I don't know if I'm overlooking something obvious, but is there a
> compact way of computing the 3-array
>
> X_{ijk} = \sum_{l} A_{il}*B_{jl}*C_{kl}
>
> out of the 2-arrays A, B, and C?

(A[:,newaxis,newaxis]*B[newaxis,:,newaxis]*C[newaxis,newaxis,:]).sum(axis=-1)