[Numpy-discussion] all elements equal

John Hunter jdh2358@gmail....
Mon Mar 5 13:32:40 CST 2012


On Mon, Mar 5, 2012 at 1:29 PM, Keith Goodman <kwgoodman@gmail.com> wrote:

>
> I[8] np.allclose(a, a[0])
> O[8] False
> I[9] a = np.ones(100000)
> I[10] np.allclose(a, a[0])
> O[10] True
>
>
One disadvantage of using a[0] as a proxy is that the result depends on the
ordering of a

  (a.max() - a.min()) < epsilon

is an alternative that avoids this.  Another good use case for a minmax
func.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120305/8787ddf7/attachment.html 


More information about the NumPy-Discussion mailing list