Re: [Numpy-discussion] Simplified question on tensordot

2010-09-03 Thread Rick Muller
Josef and Pauli, Wow, you guys rock! I'm amazed you could pull that out so quickly. I thank you, and PyQuante thanks you (hopefully this will make for faster density functional theory grids). Rick On Fri, Sep 3, 2010 at 5:59 AM, wrote: > On Fri, Sep 3, 2010 at 7:48 AM, Rick Muller wrote: > >

Re: [Numpy-discussion] Simplified question on tensordot

2010-09-03 Thread josef . pktd
On Fri, Sep 3, 2010 at 7:48 AM, Rick Muller wrote: > Sorry for the rapid repost, but I thought of a much easier way to ask the > question I asked a few minutes ago. > > I have two matrices, A and B, both of which are n x m. n is big (~10,000), > and m is small (~10). > > I want to take the product

Re: [Numpy-discussion] Simplified question on tensordot

2010-09-03 Thread Pauli Virtanen
Fri, 03 Sep 2010 05:48:31 -0600, Rick Muller wrote: [clip] > I want to take the product AB such that I get a length-n vector, as in: > > >>> AB = zeros(n,'d') > >>> for i in xrange(n): > >>>AB[i] = dot(A[i,:],B[i,:]) >>> AB = np.sum(A*B, axis=1) It does create an intermediate (n, d) matrix,

[Numpy-discussion] Simplified question on tensordot

2010-09-03 Thread Rick Muller
Sorry for the rapid repost, but I thought of a much easier way to ask the question I asked a few minutes ago. I have two matrices, A and B, both of which are n x m. n is big (~10,000), and m is small (~10). I want to take the product AB such that I get a length-n vector, as in: >>> AB = zeros(n,