On Sat, Mar 3, 2012 at 15:22, Benjamin Root <ben.r...@ou.edu> wrote:
>
>
> On Saturday, March 3, 2012, Robert Kern <robert.k...@gmail.com> wrote:
>> On Sat, Mar 3, 2012 at 14:31, Ralf Gommers <ralf.gomm...@googlemail.com>
>> wrote:
>>>
>>>
>>> On Sat, Mar 3, 2012 at 3:05 PM, Robert Kern <robert.k...@gmail.com>
>>> wrote:
>>>>
>>>> On Sat, Mar 3, 2012 at 13:59, Ralf Gommers <ralf.gomm...@googlemail.com>
>>>> wrote:
>>>> >
>>>> >
>>>> > On Thu, Mar 1, 2012 at 11:44 PM, Joe Kington <jking...@wisc.edu>
>>>> > wrote:
>>>> >>
>>>> >> Is there a numpy function for testing floating point equality that
>>>> >> returns
>>>> >> a boolean array?
>>>> >>
>>>> >> I'm aware of np.allclose, but I need a boolean array.  Properly
>>>> >> handling
>>>> >> NaN's and Inf's (as allclose does) would be a nice bonus.
>>>> >>
>>>> >> I wrote the function below to do this, but I suspect there's a method
>>>> >> in
>>>> >> numpy that I missed.
>>>> >
>>>> >
>>>> > I don't think such a function exists, would be nice to have. How about
>>>> > just
>>>> > adding a keyword "return_array" to allclose to do so?
>>>>
>>>> As a general design principle, adding a boolean flag that changes the
>>>> return type is worse than making a new function.
>>>
>>>
>>> That's certainly true as a general principle. Do you have a concrete
>>> suggestion in this case though?
>>
>> np.close()
>>
>
> When I read that, I mentally think of "close" as in closing a file.  I think
> we need a synonym.

np.isclose()

-- 
Robert Kern
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to