[SciPy-user] Numpy floating point comparisons

Zane Selvans zane@ideotrope....
Thu Dec 11 19:08:43 CST 2008


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  
values?

--
Zane Selvans
Amateur Earthling
zane@ideotrope.org
303/815-6866
http://zaneselvans.org
PGP Key: 55E0815F








-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20081211/ea509a98/attachment.html 


More information about the SciPy-user mailing list