[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] numpy.fft, yet again

2010-07-15 Thread Martin Raspaud
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 David Goldsmith skrev: Interesting comment: it made me run down the fftpack tutorial http://docs.scipy.org/scipy/docs/scipy-docs/tutorial/fftpack.rst/ josef has alluded to in the past to see if the suggested pointer could point

[Numpy-discussion] missing string formatting functionality?

2010-07-15 Thread Neal Becker
It looks like np.savetxt is pretty flexible, accepting fmt, and delimiter args. But to format into a string, we have array_repr and array_str, which are not flexible. Of course, one can use np.savetxt with python stringio, but that's more work. Would be nice if np.savetxt could just return a

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

[Numpy-discussion] isinf raises in inf

2010-07-15 Thread John Hunter
I am seeing a problem on Solaris since I upgraded to svn HEAD. np.isinf does not handle np.inf. See ipython session below. I am not seeing this problem w/ HEAD on an ubuntu linux box I tested on In [1]: import numpy as np In [2]: np.__version__ Out[2]: '2.0.0.dev8480' In [3]: x = np.inf

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

[Numpy-discussion] Matrix dot product over an axis(for a 3d array/list of matrices)

2010-07-15 Thread Emmanuel Bengio
Hello, I have a list of 4x4 transformation matrices, that I want to dot with another list of the same size (elementwise). Making a for loop that calculates the dot product of each is extremely slow, I thought that maybe it's due to the fact that I have thousands of matrices and it's a python for

Re: [Numpy-discussion] numpy.fft, yet again

2010-07-15 Thread David Goldsmith
On Thu, Jul 15, 2010 at 3:20 AM, Martin Raspaud martin.rasp...@smhi.sewrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 David Goldsmith skrev: Interesting comment: it made me run down the fftpack tutorial http://docs.scipy.org/scipy/docs/scipy-docs/tutorial/fftpack.rst/

Re: [Numpy-discussion] Matrix dot product over an axis(for a 3d array/list of matrices)

2010-07-15 Thread John Salvatier
Could you place all Rot's into the same array and all the Trans's into the same array? If you have the first index of each array refer to which array it is numpy.dot should work fine, since numpy.dot just does the dot product over the second to last and last indexes.

Re: [Numpy-discussion] Matrix dot product over an axis(for a 3d array/list of matrices)

2010-07-15 Thread Keith Goodman
On Thu, Jul 15, 2010 at 9:38 AM, Emmanuel Bengio beng...@gmail.com wrote: Hello, I have a list of 4x4 transformation matrices, that I want to dot with another list of the same size (elementwise). Making a for loop that calculates the dot product of each is extremely slow, I thought that

Re: [Numpy-discussion] Matrix dot product over an axis(for a 3d array/list of matrices)

2010-07-15 Thread Keith Goodman
On Thu, Jul 15, 2010 at 9:45 AM, Keith Goodman kwgood...@gmail.com wrote: On Thu, Jul 15, 2010 at 9:38 AM, Emmanuel Bengio beng...@gmail.com wrote: Hello, I have a list of 4x4 transformation matrices, that I want to dot with another list of the same size (elementwise). Making a for loop

Re: [Numpy-discussion] Matrix dot product over an axis(for a 3d array/list of matrices)

2010-07-15 Thread Charles R Harris
On Thu, Jul 15, 2010 at 10:38 AM, Emmanuel Bengio beng...@gmail.com wrote: Hello, I have a list of 4x4 transformation matrices, that I want to dot with another list of the same size (elementwise). Making a for loop that calculates the dot product of each is extremely slow, I thought that

[Numpy-discussion] Meshgrid and mgrid Differences

2010-07-15 Thread Jed Ludlow
Hello, all. Is there a technical reason that 'meshgrid' and 'mgrid' produce results which differ from each other by a transpose? For example, In [1]: X,Y = meshgrid(array([0,1,2,3]), array([0,1,2,3,4,5])) In [2]: X Out[2]: array([[0, 1, 2, 3], [0, 1, 2, 3], [0, 1, 2, 3],

Re: [Numpy-discussion] isinf raises in inf

2010-07-15 Thread Eric Firing
On 07/15/2010 04:54 AM, John Hunter wrote: I am seeing a problem on Solaris since I upgraded to svn HEAD. np.isinf does not handle np.inf. See ipython session below. I am not seeing this problem w/ HEAD on an ubuntu linux box I tested on In [1]: import numpy as np In [2]: np.__version__

Re: [Numpy-discussion] Matrix dot product over an axis(for a 3d array/list of matrices)

2010-07-15 Thread Emmanuel Bengio
I get about 60% of the original execution times for about any size of stack. On 15 July 2010 14:09, Charles R Harris charlesr.har...@gmail.com wrote: On Thu, Jul 15, 2010 at 12:00 PM, Emmanuel Bengio beng...@gmail.comwrote: Ok I get it. Thanks! Numpy syntax that works for me:

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?

Re: [Numpy-discussion] Matrix dot product over an axis(for a 3d array/list of matrices)

2010-07-15 Thread David Warde-Farley
On 2010-07-15, at 12:38 PM, Emmanuel Bengio beng...@gmail.com wrote: Hello, I have a list of 4x4 transformation matrices, that I want to dot with another list of the same size (elementwise). Making a for loop that calculates the dot product of each is extremely slow, I thought that maybe

Re: [Numpy-discussion] isinf raises in inf

2010-07-15 Thread Pauli Virtanen
Thu, 15 Jul 2010 09:54:12 -0500, John Hunter wrote: [clip] In [4]: np.isinf(x) Warning: invalid value encountered in isinf Out[4]: True As far as I know, isinf has always created NaNs -- since 2006 it has been defined on unsupported platforms as (!isnan((x)) isnan((x)-(x))) I'll

Re: [Numpy-discussion] isinf raises in inf

2010-07-15 Thread Eric Firing
On 07/15/2010 11:45 AM, Pauli Virtanen wrote: Thu, 15 Jul 2010 09:54:12 -0500, John Hunter wrote: [clip] In [4]: np.isinf(x) Warning: invalid value encountered in isinf Out[4]: True As far as I know, isinf has always created NaNs -- since 2006 it has been defined on unsupported platforms as

Re: [Numpy-discussion] Matrix dot product over an axis(for a 3d array/list of matrices)

2010-07-15 Thread David Warde-Farley
On 2010-07-15, at 4:31 PM, David Warde-Farley wrote: If you need/want more speed than the solution Chuck proposed, you should check out Cython and Tokyo. Cython lets you write loops that execute at C speed, whereas Tokyo provides a Cython level wrapper for BLAS (no need to go through

Re: [Numpy-discussion] Matrix dot product over an axis(for a 3d array/list of matrices)

2010-07-15 Thread Charles R Harris
On Thu, Jul 15, 2010 at 4:28 PM, David Warde-Farley d...@cs.toronto.eduwrote: On 2010-07-15, at 4:31 PM, David Warde-Farley wrote: If you need/want more speed than the solution Chuck proposed, you should check out Cython and Tokyo. Cython lets you write loops that execute at C speed,

Re: [Numpy-discussion] [SciPy-User] Saving Complex Numbers

2010-07-15 Thread David Warde-Farley
(CCing NumPy-discussion where this really belongs) On 2010-07-08, at 1:34 PM, cfra...@uci.edu wrote: Need Complex numbers in the saved file. Ack, this has come up several times according to list archives and no one's been able to provide a real answer. It seems that there is nearly no

Re: [Numpy-discussion] isinf raises in inf

2010-07-15 Thread John Hunter
On Thu, Jul 15, 2010 at 6:14 PM, Eric Firing efir...@hawaii.edu wrote: Is it certain that the Solaris compiler lacks isinf?  Is it possible that it has it, but it is not being detected? Just to clarify, I'm not using the sun compiler, but gcc-3.4.3 on solaris x86

Re: [Numpy-discussion] isinf raises in inf

2010-07-15 Thread John Hunter
On Thu, Jul 15, 2010 at 7:11 PM, John Hunter jdh2...@gmail.com wrote: On Thu, Jul 15, 2010 at 6:14 PM, Eric Firing efir...@hawaii.edu wrote: Is it certain that the Solaris compiler lacks isinf?  Is it possible that it has it, but it is not being detected? Just to clarify, I'm not using the

Re: [Numpy-discussion] isinf raises in inf

2010-07-15 Thread Charles R Harris
On Thu, Jul 15, 2010 at 6:11 PM, John Hunter jdh2...@gmail.com wrote: On Thu, Jul 15, 2010 at 6:14 PM, Eric Firing efir...@hawaii.edu wrote: Is it certain that the Solaris compiler lacks isinf? Is it possible that it has it, but it is not being detected? Just to clarify, I'm not using the

Re: [Numpy-discussion] isinf raises in inf

2010-07-15 Thread John Hunter
On Thu, Jul 15, 2010 at 7:27 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Thu, Jul 15, 2010 at 6:11 PM, John Hunter jdh2...@gmail.com wrote: On Thu, Jul 15, 2010 at 6:14 PM, Eric Firing efir...@hawaii.edu wrote: Is it certain that the Solaris compiler lacks isinf?  Is it

Re: [Numpy-discussion] isinf raises in inf

2010-07-15 Thread Charles R Harris
On Thu, Jul 15, 2010 at 6:42 PM, John Hunter jdh2...@gmail.com wrote: On Thu, Jul 15, 2010 at 7:27 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Thu, Jul 15, 2010 at 6:11 PM, John Hunter jdh2...@gmail.com wrote: On Thu, Jul 15, 2010 at 6:14 PM, Eric Firing

Re: [Numpy-discussion] isinf raises in inf

2010-07-15 Thread Charles R Harris
On Thu, Jul 15, 2010 at 6:55 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Thu, Jul 15, 2010 at 6:42 PM, John Hunter jdh2...@gmail.com wrote: On Thu, Jul 15, 2010 at 7:27 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Thu, Jul 15, 2010 at 6:11 PM, John Hunter

Re: [Numpy-discussion] isinf raises in inf

2010-07-15 Thread Charles R Harris
On Thu, Jul 15, 2010 at 7:09 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Thu, Jul 15, 2010 at 6:55 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Thu, Jul 15, 2010 at 6:42 PM, John Hunter jdh2...@gmail.com wrote: On Thu, Jul 15, 2010 at 7:27 PM, Charles R Harris

Re: [Numpy-discussion] isinf raises in inf

2010-07-15 Thread Charles R Harris
On Thu, Jul 15, 2010 at 6:42 PM, John Hunter jdh2...@gmail.com wrote: On Thu, Jul 15, 2010 at 7:27 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Thu, Jul 15, 2010 at 6:11 PM, John Hunter jdh2...@gmail.com wrote: On Thu, Jul 15, 2010 at 6:14 PM, Eric Firing