[Matrix-SIG] Question for the NumPy gurus

Travis Oliphant Oliphant.Travis@mayo.edu
Thu, 5 Aug 1999 01:29:16 -0500 (CDT)


I have two arrays with in1.shape = (N,M,P) and in2.shape = (N,P)

Is there a fast way (no Python for loop) to perform
an innerproduct element-wise along the first dimension to 
return an array of shape (N,M)?  I was hoping for the equivalent of

out = zeros((N,M))
for k in xrange(N):
    out[k] = innerproduct(in1[k],in2[k])

but with the for loop in C since N is very big.

Thanks,

Travis