[Numpy-discussion] Distance Matrix speed (original) (raw)

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


Alex Cannon wrote:

How about this?

def d5(): _return add.outer(sum(AA, axis=1), sum(BB, 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