Re: [Numpy-discussion] Any and all NaNs

2008-05-29 Thread Pauli Virtanen
to, 2008-05-29 kello 10:53 -0700, Keith Goodman kirjoitti: > On Thu, May 29, 2008 at 9:26 AM, Stéfan van der Walt <[EMAIL PROTECTED]> > wrote: > > 2008/5/23 Keith Goodman <[EMAIL PROTECTED]>: > >> On Fri, May 23, 2008 at 11:44 AM, Robert Kern <[EMAIL PROTECTED]> wrote: [clip] > >> That makes sense

Re: [Numpy-discussion] Any and all NaNs

2008-05-29 Thread Keith Goodman
On Thu, May 29, 2008 at 9:26 AM, Stéfan van der Walt <[EMAIL PROTECTED]> wrote: > 2008/5/23 Keith Goodman <[EMAIL PROTECTED]>: >> On Fri, May 23, 2008 at 11:44 AM, Robert Kern <[EMAIL PROTECTED]> wrote: >>> On Fri, May 23, 2008 at 12:22 PM, Keith Goodman <[EMAIL PROTECTED]> wrote: >>> But the

Re: [Numpy-discussion] Any and all NaNs

2008-05-29 Thread Keith Goodman
On Thu, May 29, 2008 at 9:26 AM, Stéfan van der Walt <[EMAIL PROTECTED]> wrote: > 2008/5/23 Keith Goodman <[EMAIL PROTECTED]>: >> On Fri, May 23, 2008 at 11:44 AM, Robert Kern <[EMAIL PROTECTED]> wrote: >>> On Fri, May 23, 2008 at 12:22 PM, Keith Goodman <[EMAIL PROTECTED]> wrote: >>> But the

Re: [Numpy-discussion] Any and all NaNs

2008-05-29 Thread Stéfan van der Walt
2008/5/23 Keith Goodman <[EMAIL PROTECTED]>: > On Fri, May 23, 2008 at 11:44 AM, Robert Kern <[EMAIL PROTECTED]> wrote: >> On Fri, May 23, 2008 at 12:22 PM, Keith Goodman <[EMAIL PROTECTED]> wrote: >> >>> But the first example >>> > x = mp.matrix([[mp.nan]]) > x >>> matrix([[ NaN]]) >

Re: [Numpy-discussion] Any and all NaNs

2008-05-23 Thread Keith Goodman
On Fri, May 23, 2008 at 11:44 AM, Robert Kern <[EMAIL PROTECTED]> wrote: > On Fri, May 23, 2008 at 12:22 PM, Keith Goodman <[EMAIL PROTECTED]> wrote: > >> But the first example >> x = mp.matrix([[mp.nan]]) x >> matrix([[ NaN]]) x.all() >> True x.any() >> True >> >> is stil

Re: [Numpy-discussion] Any and all NaNs

2008-05-23 Thread Robert Kern
On Fri, May 23, 2008 at 12:22 PM, Keith Goodman <[EMAIL PROTECTED]> wrote: > But the first example > >>> x = mp.matrix([[mp.nan]]) >>> x > matrix([[ NaN]]) >>> x.all() > True >>> x.any() > True > > is still surprising. On non-boolean arrays, .all() and .any() check each element to see if it

Re: [Numpy-discussion] Any and all NaNs

2008-05-23 Thread Keith Goodman
On Fri, May 23, 2008 at 10:16 AM, Keith Goodman <[EMAIL PROTECTED]> wrote: > I'm writing unit tests for a module that contains matrices. I was > surprised that these are True: > >>> import numpy.matlib as mp >>> x = mp.matrix([[mp.nan]]) >>> x.any() > True >>> x.all() > True > > My use case is

[Numpy-discussion] Any and all NaNs

2008-05-23 Thread Keith Goodman
I'm writing unit tests for a module that contains matrices. I was surprised that these are True: >> import numpy.matlib as mp >> x = mp.matrix([[mp.nan]]) >> x.any() True >> x.all() True My use case is (x == y).all() where x and y are the same matrix except that x contains one NaN. Certianl