[Numpy-discussion] funny matrix product calculation

Robin robince at gmail.com
Sun Sep 14 13:01:28 EDT 2008


Hi,

I am trying to compute the following (with summation convention):

A_{ij} B_{jm} x_{j}

where A and B are non-square arrays (in fact B=A^T) and x is a vector.
I'm actually not sure if it's valid to have 3 summation indices as
above - but I'm pretty sure that's what I want... So it's kind of
matric multiplication, but I want another vector dot'ed into the sum.

How can I implement this efficiently in numpy/scipy? I'm having
trouble breaking it down to vectorised operations. I suppose I could
try a loop in Cython but I was hoping there might be a tricky numpy
solution.

Thanks

Robin



More information about the NumPy-Discussion mailing list