comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Mode function for floating point arrays
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Mode function for floating point arrays [message #85273 is a reply to message #85269] Mon, 22 July 2013 04:24 Go to previous message
Rob Klooster is currently offline  Rob Klooster
Messages: 18
Registered: February 2013
Junior Member
Op zaterdag 20 juli 2013 01:50:08 UTC+2 schreef Matthew Argall het volgende:
> It seems like the "goodness" of this lies in how well the UNIQ function can determine if two numbers are truly unique. Then, after that, how well Value_Locate can match unique values to their duplicates. Is that right?

Exactly, UNIQ() is used for comparing floats to see if they are equal or not. You could change some lines in that function from:
indices = where(q ne shift(q,-1), count)
to:
indices = where(abs(q - shift(q,-1)) gt eps, count)
for a fixed value of eps. Be careful with this kind of comparisons, as the value to take for eps is not well defined. Take a look at this article which explains all the pitfalls when comparing floating point numbers:

http://www.cygnus-software.com/papers/comparingfloats/compar ingfloats.htm

Value_locate() will work whatever the input is, since it does not look at exact matches. It will just find the interval to which a specific number belongs. You just need to make sure that the UNIQ() function outputs the lowest number of a particular bin.


>> Note that two floats are only assumed equal when they have the exact same binary value.
>
>
>
> I think there is more information in this sentence than I can grasp at the moment... Is there any reason to suspect that the precision of the result is less than the precision of the numeric type of the input array?

Again, have a look at the article. It will make things a bit clearer.

Rob.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: IDL 8.2, read pixel value along a surface
Next Topic: Extracting pixel values from large image using RasterIterator

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 05:36:28 PDT 2025

Total time taken to generate the page: 0.56218 seconds