Re: [Numpy-discussion] equality of empty arrays

2010-10-12 Thread Friedrich Romstedt
2010/10/12 Skipper Seabold : > On Tue, Oct 12, 2010 at 12:32 PM, Robert Kern wrote: >> On Tue, Oct 12, 2010 at 11:25, Friedrich Romstedt >> wrote: >>> 2010/10/12 Skipper Seabold : Some elaboration here? http://www.scipy.org/FAQ#head-9448031cbb9760d0a44db0eceda47393e56e8270 >>> >>> I don

Re: [Numpy-discussion] equality of empty arrays

2010-10-12 Thread Skipper Seabold
On Tue, Oct 12, 2010 at 12:32 PM, Robert Kern wrote: > On Tue, Oct 12, 2010 at 11:25, Friedrich Romstedt > wrote: >> 2010/10/12 Skipper Seabold : >>> Some elaboration here? >>> http://www.scipy.org/FAQ#head-9448031cbb9760d0a44db0eceda47393e56e8270 >> >> I don't know if I understand what you want,

Re: [Numpy-discussion] equality of empty arrays

2010-10-12 Thread Robert Kern
On Tue, Oct 12, 2010 at 11:25, Friedrich Romstedt wrote: > 2010/10/12 Skipper Seabold : >> Some elaboration here? >> http://www.scipy.org/FAQ#head-9448031cbb9760d0a44db0eceda47393e56e8270 > > I don't know if I understand what you want, do you want me or someone > else to explain the section "What

Re: [Numpy-discussion] equality of empty arrays

2010-10-12 Thread Friedrich Romstedt
2010/10/12 Skipper Seabold : > Some elaboration here? > http://www.scipy.org/FAQ#head-9448031cbb9760d0a44db0eceda47393e56e8270 I don't know if I understand what you want, do you want me or someone else to explain the section "What is the preferred way to test if an array is empy?" in the scipy FAQ

Re: [Numpy-discussion] equality of empty arrays

2010-10-12 Thread Skipper Seabold
On Tue, Oct 12, 2010 at 7:40 AM, Friedrich Romstedt wrote: > 2010/10/12 Ian Goodfellow : >> If the arrays are the same size or can be broadcasted to the same >> size, it returns true or false on an elementwise basis. >> If the arrays are not the same size and can't be broadcasted to the >> same si

Re: [Numpy-discussion] equality of empty arrays

2010-10-12 Thread Friedrich Romstedt
2010/10/12 Ian Goodfellow : > If the arrays are the same size or can be broadcasted to the same > size, it returns true or false on an elementwise basis. > If the arrays are not the same size and can't be broadcasted to the > same size, it returns False, which was a surprise to me too. > >  >>> imp

Re: [Numpy-discussion] equality of empty arrays

2010-10-11 Thread Benjamin Root
On Mon, Oct 11, 2010 at 7:58 PM, Vincent Davis wrote: > On Mon, Oct 11, 2010 at 6:06 PM, Ian Goodfellow > wrote: > > The reasoning behind this is that == returns an array that specifies > > whether each element of the two arrays is equal. It's only defined if > > the arrays are the same shape (or

Re: [Numpy-discussion] equality of empty arrays

2010-10-11 Thread Ian Goodfellow
If the arrays are the same size or can be broadcasted to the same size, it returns true or false on an elementwise basis. If the arrays are not the same size and can't be broadcasted to the same size, it returns False, which was a surprise to me too. >>> import numpy as N >>> N.asarray([[0,1

Re: [Numpy-discussion] equality of empty arrays

2010-10-11 Thread Vincent Davis
On Mon, Oct 11, 2010 at 6:06 PM, Ian Goodfellow wrote: > The reasoning behind this is that == returns an array that specifies > whether each element of the two arrays is equal. It's only defined if > the arrays are the same shape (or maybe if they can be broadcasted to > the same shape). >>> m.si

Re: [Numpy-discussion] equality of empty arrays

2010-10-11 Thread Thomas, Brian (GE Energy)
Sent: Monday, October 11, 2010 8:03 PM To: Discussion of Numerical Python Subject: [Numpy-discussion] equality of empty arrays I assume there is some reasoning behind this >>> m = np.array([]) >>> n = np.array([]) >>> m==n array([], dtype=bool) I was expecting somt

Re: [Numpy-discussion] equality of empty arrays

2010-10-11 Thread josef . pktd
On Mon, Oct 11, 2010 at 8:06 PM, Ian Goodfellow wrote: > The reasoning behind this is that == returns an array that specifies > whether each element of the two arrays is equal. It's only defined if > the arrays are the same shape (or maybe if they can be broadcasted to > the same shape). > The cor

Re: [Numpy-discussion] equality of empty arrays

2010-10-11 Thread Ian Goodfellow
The reasoning behind this is that == returns an array that specifies whether each element of the two arrays is equal. It's only defined if the arrays are the same shape (or maybe if they can be broadcasted to the same shape). The correct way to check if an array is empty is to inspect its .sh

[Numpy-discussion] equality of empty arrays

2010-10-11 Thread Vincent Davis
I assume there is some reasoning behind this >>> m = np.array([]) >>> n = np.array([]) >>> m==n array([], dtype=bool) I was expecting somthing like. >>> m = [] >>> n = [] >>> m==n True What is the right way to test if an array is empty? -- Thanks Vincent Davis 720-301-3003 _