Re: [Numpy-discussion] Array concatenation performance

2010-07-16 Thread Sturla Molden
Christopher Barker skrev: However, Python lists hold python objects, so it's bit inefficient, at least in terms of memory use. I guess that is mainly in terms of memory use, as the Python (scalar) objects must be created for the call to append. np.array([]) can also be inefficient, as Anne

Re: [Numpy-discussion] Array concatenation performance

2010-07-16 Thread Christopher Barker
Sturla Molden wrote: Christopher Barker skrev: However, Python lists hold python objects, so it's bit inefficient, at least in terms of memory use. I guess that is mainly in terms of memory use, as the Python (scalar) objects must be created for the call to append. np.array([]) can also be

[Numpy-discussion] Array concatenation performance

2010-07-15 Thread John Porter
Has anyone got any advice about array creation. I've been using numpy for a long time and have just noticed something unexpected about array concatenation. It seems that using numpy.array([a,b,c]) is around 20 times slower than creating an empty array and adding the individual elements. Other

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread jf
I will be out of office till 8. August For urgent matters, please contact patrick.lambe...@heliotis.ch ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread jf
I will be out of office till 8. August For urgent matters, please contact patrick.lambe...@heliotis.ch ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread jf
I will be out of office till 8. August For urgent matters, please contact patrick.lambe...@heliotis.ch ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread jf
I will be out of office till 8. August For urgent matters, please contact patrick.lambe...@heliotis.ch ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread jf
I will be out of office till 8. August For urgent matters, please contact patrick.lambe...@heliotis.ch ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread jf
I will be out of office till 8. August For urgent matters, please contact patrick.lambe...@heliotis.ch ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread jf
I will be out of office till 8. August For urgent matters, please contact patrick.lambe...@heliotis.ch ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread jf
I will be out of office till 8. August For urgent matters, please contact patrick.lambe...@heliotis.ch ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread jf
I will be out of office till 8. August For urgent matters, please contact patrick.lambe...@heliotis.ch ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread jf
I will be out of office till 8. August For urgent matters, please contact patrick.lambe...@heliotis.ch ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread Skipper Seabold
On Thu, Jul 15, 2010 at 5:54 AM, John Porter jpor...@cambridgesys.com wrote: Has anyone got any advice about array creation. I've been using numpy for a long time and have just noticed something unexpected about array concatenation. It seems that using numpy.array([a,b,c]) is around 20 times

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread John Porter
You're right - I screwed up the timing for the one that works... It does seem to be faster. I've always just built arrays using nx.array([]) in the past though and was surprised that it performs so badly. On Thu, Jul 15, 2010 at 2:41 PM, Skipper Seabold jsseab...@gmail.com wrote: On Thu, Jul

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread Fabrice Silva
Le jeudi 15 juillet 2010 à 16:05 +0100, John Porter a écrit : You're right - I screwed up the timing for the one that works... It does seem to be faster. I've always just built arrays using nx.array([]) in the past though and was surprised that it performs so badly. Can anyone provide an

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread Skipper Seabold
On Thu, Jul 15, 2010 at 11:05 AM, John Porter jpor...@cambridgesys.com wrote: You're right - I screwed up the timing for the one that works... It does seem to be faster. I've always just built arrays using nx.array([]) in the past though and was surprised that it performs so badly. On

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread John Porter
ok - except that vstack doesn't seem to work for 2d arrays (without a reshape) which is what I'm actually after. The difference between the numpy.concatenate version and numpy.array is fairly impressive though, I get a factor of 50x. It would be nice to know why. On Thu, Jul 15, 2010 at 4:15

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread Skipper Seabold
On Thu, Jul 15, 2010 at 12:23 PM, John Porter jpor...@cambridgesys.com wrote: ok - except that vstack doesn't seem to work for 2d arrays (without a reshape) which is what I'm actually after. Ah, then you might want hstack. There is also a column_stack and row_stack if you need to go that

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread Benjamin Root
On Thu, Jul 15, 2010 at 12:38 PM, Sturla Molden stu...@molden.no wrote: Sorry for the previous mispost. This thread remids me of something I've though about for a while: Would NumPy benefit from an np.ndarraylist subclass of np.ndarray, that has an O(1) amortized append like Python lists?