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 wrote: > On Thu, Jul 15, 2010 at 7:27 PM, Charles R Harris > wrote: > > > > > > On Thu, Jul 15, 2010 at 6:11 PM, John Hunter wrote: > >> > >> On Thu, Jul 15, 2010 at 6:14 PM, Eric Firing > wrote: > >> > Is it certain that the Solaris compiler lacks

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 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 wrote: >> >>> On Thu, Jul 15, 2010 at 7:27 PM, Charles R Harris >>> wrote: >>> > >>> > >

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 wrote: > > > On Thu, Jul 15, 2010 at 6:42 PM, John Hunter wrote: > >> On Thu, Jul 15, 2010 at 7:27 PM, Charles R Harris >> wrote: >> > >> > >> > On Thu, Jul 15, 2010 at 6:11 PM, John Hunter wrote: >> >> >> >> On Thu, Jul 15, 2010 at 6:14 PM, Er

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 wrote: > On Thu, Jul 15, 2010 at 7:27 PM, Charles R Harris > wrote: > > > > > > On Thu, Jul 15, 2010 at 6:11 PM, John Hunter wrote: > >> > >> On Thu, Jul 15, 2010 at 6:14 PM, Eric Firing > wrote: > >> > Is it certain that the Solaris compiler lacks

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 wrote: > > > On Thu, Jul 15, 2010 at 6:11 PM, John Hunter wrote: >> >> On Thu, Jul 15, 2010 at 6:14 PM, Eric Firing wrote: >> > Is it certain that the Solaris compiler lacks isinf?  Is it possible >> > that it has it, but it is not being detected

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 wrote: > On Thu, Jul 15, 2010 at 6:14 PM, Eric Firing 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

Re: [Numpy-discussion] isinf raises in inf

2010-07-15 Thread John Hunter
On Thu, Jul 15, 2010 at 7:11 PM, John Hunter wrote: > On Thu, Jul 15, 2010 at 6:14 PM, Eric Firing 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

Re: [Numpy-discussion] isinf raises in inf

2010-07-15 Thread John Hunter
On Thu, Jul 15, 2010 at 6:14 PM, Eric Firing 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] [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 format

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 wrote: > 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 provid

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 Py

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" pl

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'l

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 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 it's due

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread Anne Archibald
On 15 July 2010 13:38, Sturla Molden 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? (Other methods of Python l

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread Benjamin Root
On Thu, Jul 15, 2010 at 12:38 PM, Sturla Molden 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? (Other methods

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 wrote: > > > On Thu, Jul 15, 2010 at 12:00 PM, Emmanuel Bengio wrote: > >> Ok I get it. Thanks! >> >> Numpy syntax that works for me: >> numpy.sum(a[:,:,:,numpy.newaxis]*b[:,numpy

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.__versi

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 12:00 PM, Emmanuel Bengio wrote: > Ok I get it. Thanks! > > Numpy syntax that works for me: > numpy.sum(a[:,:,:,numpy.newaxis]*b[:,numpy.newaxis,:,:],axis=-2) > > The leading "..." gives the same thing, but iterates over all the leading indicies in case you want multidimen

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

2010-07-15 Thread Emmanuel Bengio
Ok I get it. Thanks! Numpy syntax that works for me: numpy.sum(a[:,:,:,numpy.newaxis]*b[:,numpy.newaxis,:,:],axis=-2) On 15 July 2010 13:46, Charles R Harris wrote: > > > On Thu, Jul 15, 2010 at 11:32 AM, Emmanuel Bengio wrote: > >> >Could you place all Rot's into the same array and all the Tra

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 11:32 AM, Emmanuel Bengio wrote: > >Could you place all Rot's into the same array and all the Trans's into the > same array? > Well I guess since they're all the same size. I would just have to do > array(a). But the result of the dot product of two 3d arrays is most > une

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread Sturla Molden
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? (Other methods of Python lists (pop, extend) would be worth considering as we

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

2010-07-15 Thread Emmanuel Bengio
>Could you place all Rot's into the same array and all the Trans's into the same array? Well I guess since they're all the same size. I would just have to do array(a). But the result of the dot product of two 3d arrays is most unexpected: >>> a = numpy.ones((4,5,6)) >>> a = numpy.ones((10,4,4)) >>>

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread Sturla Molden
Den 15.07.2010 15:41, skrev Skipper Seabold: > On Thu, Jul 15, 2010 at 5:54 AM, John Porter 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 nu

[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], [0,

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 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 it's

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 wrote: > On Thu, Jul 15, 2010 at 9:38 AM, Emmanuel Bengio 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

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 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 it's

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. http://docs.scipy.org/doc/numpy

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

2010-07-15 Thread David Goldsmith
On Thu, Jul 15, 2010 at 3:20 AM, Martin Raspaud wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > David Goldsmith skrev: > > > > > > Interesting comment: it made me run down the fftpack tutorial > > > > jose

[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 fo

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread Skipper Seabold
On Thu, Jul 15, 2010 at 12:23 PM, John Porter 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 route. > The difference b

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 PM

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread Skipper Seabold
On Thu, Jul 15, 2010 at 11:05 AM, John Porter 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 Thu, Jul 15, 2010 a

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 a

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 wrote: > On Thu, Jul 15, 2010 at 5:54 AM,

[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 np.inf

Re: [Numpy-discussion] Array concatenation performance

2010-07-15 Thread Skipper Seabold
On Thu, Jul 15, 2010 at 5:54 AM, John Porter 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 slower > than creati

[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] 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 > > josef has alluded to in the past to see if the suggested pointer > could

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

[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 thi