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

Home » Public Forums » archive » Re: Comparing 2 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: Comparing 2 arrays [message #55669 is a reply to message #55557] Tue, 28 August 2007 08:15 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Jean H. writes:

> to get back to a previous discussion we had a few month ago about being
> "sufficiently close to zero", shouldn't it be (data1.A - data2.B) LT
> epsilon * data1.A , with epsilon=(machar()).eps?

OK, I found that discussion and read it eight or ten times until
I finally understood it. (Probably why I forgot it before.)

I've put a significantly edited discussion of this
problem here:

http://www.dfanning.com/code_tips/comparearray.html

In my preferred solution now, I choose a number that
is "sufficiently close" to zero like this:

epsilon = (MACHAR()).eps
NUMBER = (array_1 > array_2) * epsilon

Then, the comparison between arrays is done like this:

IF Total(Abs(array_1 - array_2) LT NUMBER) EQ N_Elements(array_1) $
THEN RETURN, 1 ELSE RETURN, 0

Additional comments welcome if you want to argue further. :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Is there somebody familiar with nurbs or b-Spline?
Next Topic: File Output in IDL

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

Current Time: Sat Oct 11 08:12:17 PDT 2025

Total time taken to generate the page: 0.24005 seconds