Re: [Numpy-discussion] Sum of the product of three or more arrays

2007-10-19 Thread Geoffrey Zhu
On 10/18/07, Robert Kern <[EMAIL PROTECTED]> wrote: > Geoffrey Zhu wrote: > > Hi All, > > > > Given three vectors of the same lengths, X, Y, and Z, I am looking for > > an efficient way to calculate the following: > > > > sum(x[i]*y[i]*z[i], for i=1..n ) > > (x*y*z).sum() > > -- > Robert Kern > > "

Re: [Numpy-discussion] Sum of the product of three or more arrays

2007-10-18 Thread Robert Kern
Geoffrey Zhu wrote: > Hi All, > > Given three vectors of the same lengths, X, Y, and Z, I am looking for > an efficient way to calculate the following: > > sum(x[i]*y[i]*z[i], for i=1..n ) (x*y*z).sum() -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigm

Re: [Numpy-discussion] Sum of the product of three or more arrays

2007-10-18 Thread Geoffrey Zhu
I think I figured out: sum(X*Y*Z). Never mind. On 10/18/07, Geoffrey Zhu <[EMAIL PROTECTED]> wrote: > Hi All, > > Given three vectors of the same lengths, X, Y, and Z, I am looking for > an efficient way to calculate the following: > > sum(x[i]*y[i]*z[i], for i=1..n ) > > > I am not sure if there

[Numpy-discussion] Sum of the product of three or more arrays

2007-10-18 Thread Geoffrey Zhu
Hi All, Given three vectors of the same lengths, X, Y, and Z, I am looking for an efficient way to calculate the following: sum(x[i]*y[i]*z[i], for i=1..n ) I am not sure if there is a vectorized way to do this. Thanks, Geoffrey ___ Numpy-discussion