[Numpy-discussion] Faster
Hoyt Koepke
hoytak@gmail....
Sat May 3 01:51:33 CDT 2008
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.
--Hoyt
On Fri, May 2, 2008 at 5:47 PM, Keith Goodman <kwgoodman@gmail.com> wrote:
>
> On Fri, May 2, 2008 at 5:38 PM, Charles R Harris
> <charlesr.harris@gmail.com> wrote:
> > On Fri, May 2, 2008 at 6:24 PM, Keith Goodman <kwgoodman@gmail.com> wrote:
> > > How can I make this function faster? It removes the i-th row and
> > > column from an array.
> > >
> >
> > Why do you want to do that?
>
> Single linkage clustering; x is the distance matrix.
>
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
--
+++++++++++++++++++++++++++++++++++
Hoyt Koepke
UBC Department of Computer Science
http://www.cs.ubc.ca/~hoytak/
hoytak@gmail.com
+++++++++++++++++++++++++++++++++++
More information about the Numpy-discussion
mailing list