Oops. Looks like I forgot to attach the test program that generated
that output so you can tell what dist2g actually does.
Funny thing is -- despite being written in C, hypot doesn't actually
win any of the test cases for which it's applicable.
--bb
On 4/17/07, Bill Baxter <[EMAIL PROTECTED]> w
Christopher Barker wrote:
> Matthieu Brucher wrote:
>> you can probably use numpy.hypot(v-y) to speed this up more...
>>
>> Tried it today, hypot takes two arguments :(
>> Is there a function that does the square root of the sum of squares ?
>
> then maybe you want:
>
> numpy.hypot(v-y,v-y),
Matthieu Brucher wrote:
> you can probably use numpy.hypot(v-y) to speed this up more...
>
>
> Tried it today, hypot takes two arguments :(
> Is there a function that does the square root of the sum of squares ?
then maybe you want:
numpy.hypot(v-y,v-y), though you should probably make a te
Or
f = sqrt(dot(x,x))
Am 17.04.2007 um 16:12 schrieb Sturla Molden:
f = lambda x : sqrt(sum(x**2))
PGP.sig
Description: Signierter Teil der Nachricht
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/li
On 4/17/2007 3:57 PM, Matthieu Brucher wrote:
> Is there a function that does the square root of the sum of squares ?
hm ...
f = lambda x : sqrt(sum(x**2))
S.M.
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/m
you can probably use numpy.hypot(v-y) to speed this up more...
Tried it today, hypot takes two arguments :(
Is there a function that does the square root of the sum of squares ?
Matthieu
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
h
Here's a bunch of dist matrix implementations and their timings.
The upshot is that for most purposes this seems to be the best or at
least not too far off (basically the cookbook solution Kier posted)
def dist2hd(x,y):
"""Generate a 'coordinate' of the solution at a time"""
d = npy.zeros((
On 4/13/07, Timothy Hochberg <[EMAIL PROTECTED]> wrote:
> On 4/13/07, Bill Baxter <[EMAIL PROTECTED]> wrote:
> > I think someone posted some timings about this before but I don't recall.
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/498246
[snip]
> I'm going to go out on a limb and cont
Timothy Hochberg wrote:
> results = empty([M, N], float)
> # You could be fancy and swap axes depending on which array is larger, but
> # I'll leave that for someone else
> for i, v in enumerate(x):
> results[i] = sqrt(sum((v-y)**2, axis=-1))
you can probably use numpy.hypot(v-y) to speed thi
On 4/13/07, Bill Baxter <[EMAIL PROTECTED]> wrote:
I think someone posted some timings about this before but I don't recall.
The task is to compute the matrix D from two sets of vectors x (M,d)
and y (N,d).
The output should be D where D[i,j] is norm(x[i]-y[j])
The Matlab NetLab toolkit uses
I think someone posted some timings about this before but I don't recall.
The task is to compute the matrix D from two sets of vectors x (M,d)
and y (N,d).
The output should be D where D[i,j] is norm(x[i]-y[j])
The Matlab NetLab toolkit uses something like this to compute it:
d2 = (x*x).sum
11 matches
Mail list logo