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

Home » Public Forums » archive » Turning off math error checking for a code block
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: Turning off math error checking for a code block [message #28964 is a reply to message #28898] Fri, 18 January 2002 15:30 Go to previous messageGo to previous message
bowman is currently offline  bowman
Messages: 121
Registered: September 1991
Senior Member
Well, it makes more sense if both blocks of code do the same work. ;-)

Turning off error checking is still faster, though.

Turn off error checking, t = 0.45098495
Do WHERE twice, t = 2.5393230

Ken


PRO TEST_FINITE

n = 1024L*1024L
nmiss = 100L*1024L
x = RANDOMN(seed, n) ;Create 10^ random numbers
miss = LONG(n*RANDOMU(seed, nmiss)) ;Generate 10^5 random indices
x[miss] = !VALUES.F_NAN ;Set random indices to missing
x_min = 0.0


t = SYSTIME(/SECONDS)
error = CHECK_MATH(/PRINT)
save_except = !EXCEPT
!EXCEPT = 0
i = WHERE(x LT x_min, ni)
IF (ni GT 0) THEN x[i] = !VALUES.F_NAN
error = CHECK_MATH()
!EXCEPT = save_except
PRINT, 'Turn off error checking, t = ', SYSTIME(/SECONDS) - t


t = SYSTIME(/SECONDS)
i = WHERE(FINITE(x), ni)
IF (ni GT 0) THEN BEGIN
y = x[i]
j = WHERE(y LT x_min, nj)
IF (nj GT 0) THEN BEGIN
y[j] = !VALUES.F_NAN
x[i] = y
ENDIF
ENDIF
PRINT, 'Do WHERE twice, t = ', SYSTIME(/SECONDS) - t

END
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Turning off math error checking for a code block
Next Topic: Re: Passing an array from IDL to MPI

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

Current Time: Fri Oct 10 10:36:33 PDT 2025

Total time taken to generate the page: 0.95722 seconds