Re: Turning off math error checking for a code block [message #28876 is a reply to message #28871] |
Thu, 17 January 2002 16:06   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
k-bowman@null.com (Kenneth Bowman) writes:
> In article <3C47094C.1F1879D2@ssec.wisc.edu>, "Liam E. Gumley" <Liam.Gumley@ssec.wisc.edu> wrote:
>
>> The FINITE function returns 1 where the argument is finite, and 0 where
>> the argument is infinite *or* NaN (see p. 134 of my book). Try the
>> following:
>>
>> x_min = 2.0
>> index = where(finite(x) eq 1, count)
>> if (count gt 0) then print, where(x[index] lt x_min)
>
> I am aware of that. These are relatively large vectors (10^5 to
> 10^6 elements), however, and this operation is repeated many times,
> so I am trying to avoid extracting the finite values (or creating an
> array index to them). This is my "innermost loop", and efficiency
> is important. I know there are NaN's. I prefer to simply turn off
> the error messages.
I have found that an operation on an array which contains NANs is
slowed down considerably. I think it is because each operation causes
a floating point exception which is handled in the OS. I use WHERE
most of the time when this comes up. Occassionally I get "floating
exception" messages, but big whoop.
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|