[Numpy-discussion] Faster

Keith Goodman kwgoodman@gmail....
Sat May 3 08:48:34 CDT 2008


On Fri, May 2, 2008 at 11:51 PM, Hoyt Koepke <hoytak@gmail.com> wrote:
> You know, for linkage clustering and BHC, I've found it a lot easier
>  to work with an intermediate 1d map of indices and never resize the
>  distance matrix.  I then just remove one element from this map at each
>  iteration, which is a LOT faster than removing a column and a row from
>  a matrix.  if idxmap were the map, you would be working with
>  X[idxmap[i], idxmap[j] ] instead of X[i, j].  Also, you could even use
>  a python list in this case, as they are a lot better for deletions
>  than an array.

I thought of replacing the row and column with 1e10 instead of
deleting it. But your idea is better. If I use lists then I bet Psyco
will speed things up. Thanks for the tip.


More information about the Numpy-discussion mailing list