[Numpy-discussion] Distance Matrix speed

Robert Kern robert.kern at gmail.com
Sat Jun 17 16:49:16 CDT 2006

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

More information about the Numpy-discussion mailing list