Le 29/10/2013 11:37, Pierre Haessig a écrit :
> def compare(point, other):
>     delta = point - other
>     argmax = np.abs(delta).argmax()
>     delta_max = delta[argmax]
>     if delta_max > 0:
>         return 1
>     elif delta_max < 0:
>         return -1
>     else:
>         return 0
>
> This function returns a comparison of the coordinates with the  biggest
> absolute difference. Of course this doesn't define an *absolute order*
> (since it doesn't exist). But I think it defines a *relative order* (if
> this notion exists mathematically !!!!) which is indeed robust.
In fact this comparison is not robust for points whose difference has
two coordinates of almost same absolute magnitude but of different sign :

p1 = np.array([1,-1,0])
p2 = np.array([1,-1+1e-3,0])
p3 = np.array([1,-1-1e-3,0])

compare(p1,p1)
Out[26]: 0

compare(p1,p2)
Out[27]: -1

compare(p1,p3)
Out[28]: 1

sorry,
Pierre

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to