[SciPy-user] Numpy floating point comparisons
Fri Dec 12 00:41:55 CST 2008
I don't think you can do better than make a new difference array, get
its absolute value, compare it to some small value and use the result.
This it what you would do in any language, so try it ;)
2008/12/12 Zane Selvans <email@example.com>:
> Okay, let's try that again...
> I'm sure that this problem has come up before, and caused headaches, and
> hopefully someone can just point me at the appropriate documentation... but,
> I'm having issues doing floating point value comparisons...
> Specifically, I have two arrays of floating point values A and B, which have
> different lengths, and I want to do something semantically equivalent to:
> X = B[where(A in B[:,0])] ]
> But the array set operations of course don't do well when the values being
> compared are floating point, so:
> X = B[where(numpy.lib.arraysetops.setmember1d(B[:,0],A))]
> works unreliably.
> Is there a way to do this quickly, that also works for floating point
> Zane Selvans
> Amateur Earthling
> PGP Key: 55E0815F
> SciPy-user mailing list
Information System Engineer, Ph.D.
Blogs: http://matt.eifelle.com and http://blog.developpez.com/?blog=92
More information about the SciPy-user