[Numpy-discussion] Optimized sum of squares
Gael Varoquaux
gael.varoquaux@normalesup....
Sun Oct 18 07:09:27 CDT 2009
On Sun, Oct 18, 2009 at 09:06:15PM +1100, Gary Ruben wrote:
> Hi Gaël,
> If you've got a 1D array/vector called "a", I think the normal idiom is
> np.dot(a,a)
> For the more general case, I think
> np.tensordot(a, a, axes=something_else)
> should do it, where you should be able to figure out something_else for
> your particular case.
Ha, yes. Good point about the tensordot trick.
Thank you
Gaël
More information about the NumPy-Discussion
mailing list