> > I think dot will work, though you'll need to work a little bit to get the > answer: > > >>> import numpy as np > >>> a = np.array([[1,2], [3,4]], np.float) > >>> aa = np.array([a,a+1,a+2]) > >>> bb = np.array((a*5, a*6, a*7, a*8)) > >>> np.dot(aa, bb).shape > (3, 2, 4, 2) > >>> for i, a_ in enumerate(aa): > ... for j, b_ in enumerate(bb): > ... print (np.dot(a_, b_) == np.dot(aa, bb)[i,:,j,:]).all() > ... > True >
Thanks. Your comment has helped me understand what dot() does for ndims>2 . It's a pity this will be too memory inefficient for large N. Bryan > _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion