[Numpy-discussion] Concatenating Arrays to make Views

2008-12-15 Thread Benjamin Haynor
Hi, I was wondering if I can concatenate 3 arrays, where the result will be a view of the original three arrays, instead of a copy of the data. For example, suppose I write the following import numpy as n a = n.array([[1,2],[3,4]]) b = n.array([[5,6],[7,8]]) c = n.array([[9,10],[11,12]]) c =

Re: [Numpy-discussion] Efficient removal of duplicates

2008-12-15 Thread Alan G Isaac
Hanno Klemm wrote: I the following problem: I have a relatively long array of points [(x0,y0), (x1,y1), ...]. Apparently, I have some duplicate entries, which prevents the Delaunay triangulation algorithm from completing its task. Question, is there an efficent way, of getting rid of the

Re: [Numpy-discussion] Efficient removal of duplicates

2008-12-15 Thread Andrew Straw
Hanno Klemm wrote: Hi, I the following problem: I have a relatively long array of points [(x0,y0), (x1,y1), ...]. Apparently, I have some duplicate entries, which prevents the Delaunay triangulation algorithm from completing its task. Question, is there an efficent way, of getting rid of

Re: [Numpy-discussion] Efficient removal of duplicates

2008-12-15 Thread Robert Kern
On Mon, Dec 15, 2008 at 10:27, Hanno Klemm kl...@phys.ethz.ch wrote: Hi, I the following problem: I have a relatively long array of points [(x0,y0), (x1,y1), ...]. Apparently, I have some duplicate entries, which prevents the Delaunay triangulation algorithm from completing its task.

Re: [Numpy-discussion] Concatenating Arrays to make Views

2008-12-15 Thread Robert Kern
On Mon, Dec 15, 2008 at 11:39, Benjamin Haynor bhay...@hotmail.com wrote: Hi, I was wondering if I can concatenate 3 arrays, where the result will be a view of the original three arrays, instead of a copy of the data. No, this is not possible in general with numpy's memory model. -- Robert

Re: [Numpy-discussion] Concatenating Arrays to make Views

2008-12-15 Thread Anne Archibald
2008/12/15 Benjamin Haynor bhay...@hotmail.com: I was wondering if I can concatenate 3 arrays, where the result will be a view of the original three arrays, instead of a copy of the data. For example, suppose I write the following import numpy as n a = n.array([[1,2],[3,4]]) b =

[Numpy-discussion] Mersenne twister seeds

2008-12-15 Thread Michael Gilbert
According to wikipedia [1], some common Mersenne twister algorithms use a linear congruential gradient (LCG) to generate seeds. LCGs have been known to produce poor random numbers. Does numpy's Mersenne twister do this? And if so, is this potentially a problem?

Re: [Numpy-discussion] Mersenne twister seeds

2008-12-15 Thread Kevin Jacobs jac...@bioinformed.com
On Mon, Dec 15, 2008 at 6:01 PM, Michael Gilbert michael.s.gilb...@gmail.com wrote: According to wikipedia [1], some common Mersenne twister algorithms use a linear congruential gradient (LCG) to generate seeds. LCGs have been known to produce poor random numbers. Does numpy's Mersenne

Re: [Numpy-discussion] Mersenne twister seeds

2008-12-15 Thread Ravi
On Monday 15 December 2008 18:01:41 Michael Gilbert wrote: According to wikipedia [1], some common Mersenne twister algorithms use a linear congruential gradient (LCG) to generate seeds.  LCGs have been known to produce poor random numbers.  Does numpy's Mersenne twister do this?  And if so,

Re: [Numpy-discussion] Mersenne twister seeds

2008-12-15 Thread Alan G Isaac
On 12/15/2008 6:01 PM Michael Gilbert apparently wrote: According to wikipedia [1], some common Mersenne twister algorithms use a linear congruential gradient (LCG) to generate seeds. LCGs have been known to produce poor random numbers. Does numpy's Mersenne twister do this? And if so, is

Re: [Numpy-discussion] Efficient removal of duplicates

2008-12-15 Thread Daran Rife
How about a solution inspired by recipe 18.1 in the Python Cookbook, 2nd Ed: import numpy as np a = [(x0,y0), (x1,y1), ...] l = a.tolist() l.sort() unique = [x for i, x in enumerate(l) if not i or x != b[l-1]] a_unique = np.asarray(unique) Performance of this approach should be highly scalable.

Re: [Numpy-discussion] Efficient removal of duplicates

2008-12-15 Thread Daran Rife
Whoops! A hasty cut-and-paste from my IDLE session. This should read: import numpy as np a = [(x0,y0), (x1,y1), ...] # A numpy array, but could be a list l = a.tolist() l.sort() unique = [x for i, x in enumerate(l) if not i or x != l[i-1]] # a_unique = np.asarray(unique) Daran -- On Dec

Re: [Numpy-discussion] Efficient removal of duplicates

2008-12-15 Thread Robert Kern
On Mon, Dec 15, 2008 at 18:24, Daran Rife dr...@ucar.edu wrote: How about a solution inspired by recipe 18.1 in the Python Cookbook, 2nd Ed: import numpy as np a = [(x0,y0), (x1,y1), ...] l = a.tolist() l.sort() unique = [x for i, x in enumerate(l) if not i or x != b[l-1]] a_unique =

Re: [Numpy-discussion] unique1d docs (was: Efficient removal of duplicates)

2008-12-15 Thread josef . pktd
On Mon, Dec 15, 2008 at 9:21 PM, Alan G Isaac ais...@american.edu wrote: On 12/15/2008 7:53 PM Robert Kern apparently wrote: That basic idea is what unique1d() does; however, it uses numpy primitives to keep the heavy lifting in C instead of Python. I noticed that unique1d is not documented

Re: [Numpy-discussion] unique1d docs

2008-12-15 Thread Alan G Isaac
On Mon, Dec 15, 2008 at 9:21 PM, Alan G Isaac wrote: I noticed that unique1d is not documented on the Numpy Example List http://www.scipy.org/Numpy_Example_List but is documented on the Numpy Example List with Doc http://www.scipy.org/Numpy_Example_List_With_Doc I thought the latter was

Re: [Numpy-discussion] unique1d docs

2008-12-15 Thread josef . pktd
On Mon, Dec 15, 2008 at 10:18 PM, Alan G Isaac ais...@american.edu wrote: On Mon, Dec 15, 2008 at 9:21 PM, Alan G Isaac wrote: I noticed that unique1d is not documented on the Numpy Example List http://www.scipy.org/Numpy_Example_List but is documented on the Numpy Example List with Doc

Re: [Numpy-discussion] unique1d docs

2008-12-15 Thread Jarrod Millman
On Mon, Dec 15, 2008 at 8:37 PM, josef.p...@gmail.com wrote: What's the future of the example list, on the example list with docs it says Numpy 1.0.4. It hasn't been updated in a while. When I started out with numpy, I used it as a main reference, but now, some examples, that I wanted to look