Re: [Numpy-discussion] Robust Sorting of Points

2013-10-29 Thread Freddie Witherden
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 28/10/2013 12:44, Pierre Haessig wrote: Hi, Le 27/10/2013 19:28, Freddie Witherden a écrit : I wish to sort these points into a canonical order in a fashion which is robust against small perturbations. In other words changing any component

Re: [Numpy-discussion] Robust Sorting of Points

2013-10-29 Thread Pierre Haessig
Hi Freddie, Le 29/10/2013 10:21, Freddie Witherden a écrit : The order itself does not need to satisfy any specific properties. I can't agree with you : if there is no specific property, then keeping the list *unchanged* would be a fine solution (and very fast and very very robust) ;-) what

Re: [Numpy-discussion] Robust Sorting of Points

2013-10-29 Thread Pierre Haessig
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

Re: [Numpy-discussion] Robust Sorting of Points

2013-10-28 Thread Pierre Haessig
Hi, Le 27/10/2013 19:28, Freddie Witherden a écrit : I wish to sort these points into a canonical order in a fashion which is robust against small perturbations. In other words changing any component of any of the points by an epsilon ~ 1e-12 should not affect the resulting sorted order. Can

Re: [Numpy-discussion] Robust Sorting of Points

2013-10-28 Thread Thouis (Ray) Jones
Always, *always*, or just with high enough probability that you don't realistically have to worry about it failing. If the latter, I wonder if you could do something with random projections. Off the top of my head, I wonder if something like the sum of ranks when ordered under a set of random

Re: [Numpy-discussion] Robust Sorting of Points

2013-10-28 Thread Brett Olsen
Here's some code implementing the replace similar values with an arbitrarily chosen one (in this case the smallest of the similar values). I didn't see any way to do this cleverly with strides, so I just did a simple loop. It's about 100 times slower in pure Python, or a bit under 10 times

[Numpy-discussion] Robust Sorting of Points

2013-10-27 Thread Freddie Witherden
Hi all, This is a question which has been bugging me for a while. I have an (N, 3) array where N ~ 16 of points. These points are all unique and separated by a reasonable distance. I wish to sort these points into a canonical order in a fashion which is robust against small perturbations. In

Re: [Numpy-discussion] Robust Sorting of Points

2013-10-27 Thread Nathaniel Smith
On Sun, Oct 27, 2013 at 6:28 PM, Freddie Witherden fred...@witherden.org wrote: Hi all, This is a question which has been bugging me for a while. I have an (N, 3) array where N ~ 16 of points. These points are all unique and separated by a reasonable distance. I wish to sort these points

Re: [Numpy-discussion] Robust Sorting of Points

2013-10-27 Thread Freddie Witherden
On 27/10/13 18:35, Nathaniel Smith wrote: On Sun, Oct 27, 2013 at 6:28 PM, Freddie Witherden fred...@witherden.org wrote: Hi all, This is a question which has been bugging me for a while. I have an (N, 3) array where N ~ 16 of points. These points are all unique and separated by a

Re: [Numpy-discussion] Robust Sorting of Points

2013-10-27 Thread Daniele Nicolodi
On 27/10/2013 19:42, Freddie Witherden wrote: On 27/10/13 18:35, Nathaniel Smith wrote: On Sun, Oct 27, 2013 at 6:28 PM, Freddie Witherden fred...@witherden.org wrote: Hi all, This is a question which has been bugging me for a while. I have an (N, 3) array where N ~ 16 of points. These

Re: [Numpy-discussion] Robust Sorting of Points

2013-10-27 Thread Freddie Witherden
On 27/10/13 18:54, Daniele Nicolodi wrote: On 27/10/2013 19:42, Freddie Witherden wrote: On 27/10/13 18:35, Nathaniel Smith wrote: On Sun, Oct 27, 2013 at 6:28 PM, Freddie Witherden fred...@witherden.org wrote: Hi all, This is a question which has been bugging me for a while. I have an (N,

Re: [Numpy-discussion] Robust Sorting of Points

2013-10-27 Thread josef . pktd
On Sun, Oct 27, 2013 at 3:22 PM, Freddie Witherden fred...@witherden.org wrote: On 27/10/13 18:54, Daniele Nicolodi wrote: On 27/10/2013 19:42, Freddie Witherden wrote: On 27/10/13 18:35, Nathaniel Smith wrote: On Sun, Oct 27, 2013 at 6:28 PM, Freddie Witherden fred...@witherden.org wrote:

Re: [Numpy-discussion] Robust Sorting of Points

2013-10-27 Thread josef . pktd
On Sun, Oct 27, 2013 at 4:22 PM, josef.p...@gmail.com wrote: On Sun, Oct 27, 2013 at 3:22 PM, Freddie Witherden fred...@witherden.org wrote: On 27/10/13 18:54, Daniele Nicolodi wrote: On 27/10/2013 19:42, Freddie Witherden wrote: On 27/10/13 18:35, Nathaniel Smith wrote: On Sun, Oct 27,

Re: [Numpy-discussion] Robust Sorting of Points

2013-10-27 Thread Freddie Witherden
On 27/10/13 20:22, josef.p...@gmail.com wrote: On Sun, Oct 27, 2013 at 3:22 PM, Freddie Witherden fred...@witherden.org wrote: On 27/10/13 18:54, Daniele Nicolodi wrote: On 27/10/2013 19:42, Freddie Witherden wrote: On 27/10/13 18:35, Nathaniel Smith wrote: On Sun, Oct 27, 2013 at 6:28 PM,

Re: [Numpy-discussion] Robust Sorting of Points

2013-10-27 Thread Jonathan March
If an almost always works solution is good enough, then sort on the distance to some fixed random point that is in the vicinity of your N points. Jonathan On Sun, Oct 27, 2013 at 3:51 PM, Freddie Witherden fred...@witherden.orgwrote: On 27/10/13 20:22, josef.p...@gmail.com wrote: On Sun,

Re: [Numpy-discussion] Robust Sorting of Points

2013-10-27 Thread Freddie Witherden
On 27/10/13 21:05, Jonathan March wrote: If an almost always works solution is good enough, then sort on the distance to some fixed random point that is in the vicinity of your N points. I had considered this. Unfortunately I need a solution which really does always work. The only

Re: [Numpy-discussion] Robust Sorting of Points

2013-10-27 Thread Nathaniel Smith
On Sun, Oct 27, 2013 at 10:41 PM, Freddie Witherden fred...@witherden.org wrote: On 27/10/13 21:05, Jonathan March wrote: If an almost always works solution is good enough, then sort on the distance to some fixed random point that is in the vicinity of your N points. I had considered this.

Re: [Numpy-discussion] Robust Sorting of Points

2013-10-27 Thread Charles R Harris
On Sun, Oct 27, 2013 at 12:28 PM, Freddie Witherden fred...@witherden.orgwrote: Hi all, This is a question which has been bugging me for a while. I have an (N, 3) array where N ~ 16 of points. These points are all unique and separated by a reasonable distance. I wish to sort these points

Re: [Numpy-discussion] Robust Sorting of Points

2013-10-27 Thread Charles R Harris
On Sun, Oct 27, 2013 at 10:13 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Sun, Oct 27, 2013 at 12:28 PM, Freddie Witherden fred...@witherden.org wrote: Hi all, This is a question which has been bugging me for a while. I have an (N, 3) array where N ~ 16 of points. These