Alex Cannon wrote: > How about this? > > def d5(): > return add.outer(sum(A*A, axis=1), sum(B*B, axis=1)) - \ > 2.*dot(A, transpose(B))
You might lose some precision with that approach, so the OP should compare results and timings to look at the tradeoffs. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion