[Numpy-discussion] funny matrix product calculation

Nadav Horesh nadavh at visionsense.com
Sun Sep 14 13:50:53 EDT 2008


Not a supper efficient solution, but mat sill may work:

dot(A, B*x[:,None])
 or
dot(A*x, B)

   Nadav

-----הודעה מקורית-----
מאת: numpy-discussion-bounces at scipy.org בשם Robin
נשלח: א 14-ספטמבר-08 20:01
אל: Discussion of Numerical Python
נושא: [Numpy-discussion] funny matrix product calculation
 
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
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion at scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 3296 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080914/279f98aa/attachment.bin>


More information about the NumPy-Discussion mailing list