Re: [Numpy-discussion] distance matrix and (weighted) p-norm

2008-09-07 Thread Jarrod Millman
On Sun, Sep 7, 2008 at 4:07 PM, Emanuele Olivetti <[EMAIL PROTECTED]> wrote: > David said that distance computation will be moved in a > separate package soon. I guess that your implementation > will be the suitable one for this package. Am I wrong? Yes, that is correct. David was talking about p

Re: [Numpy-discussion] distance matrix and (weighted) p-norm

2008-09-07 Thread Emanuele Olivetti
Excellent. David said that distance computation will be moved in a separate package soon. I guess that your implementation will be the suitable one for this package. Am I wrong? Thanks again, Emanuele Damian Eads wrote: > Hi there, > > The pdist function computes pairwise distances between vect

Re: [Numpy-discussion] distance matrix and (weighted) p-norm

2008-09-07 Thread Damian Eads
Hi there, The pdist function computes pairwise distances between vectors in a single collection, storing the distances in a condensed distance matrix. This is not exactly what you want--you want to compute distance between two collections of vectors. Suppose XA is a m_A by n array and XB is

Re: [Numpy-discussion] sum of positive values in an array

2008-09-07 Thread Michael McNeil Forbes
On Sep 5, 2008, at 8:52 AM, Keith Goodman wrote: > Here's another difference: > >>> a = np.random.randn(10) >>> timeit np.sum(a[np.where(a>0)]) > 100 loops, best of 3: 3.44 ms per loop >>> timeit a[a > 0].sum() > 100 loops, best of 3: 2.21 ms per loop Here is an even faster method (but much m

Re: [Numpy-discussion] sum of positive values in an array

2008-09-07 Thread Michael McNeil Forbes
On Sep 5, 2008, at 8:52 AM, Keith Goodman wrote: > Here's another difference: > >>> a = np.random.randn(10) >>> timeit np.sum(a[np.where(a>0)]) > 100 loops, best of 3: 3.44 ms per loop >>> timeit a[a > 0].sum() > 100 loops, best of 3: 2.21 ms per loop Here is an even faster method (but much m