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

Home » Public Forums » archive » Re: transforming an array where some values can't
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: transforming an array where some values can't [message #10908 is a reply to message #10907] Thu, 05 February 1998 00:00 Go to previous message
meron is currently offline  meron
Messages: 51
Registered: July 1995
Member
In article <1998Feb5.094807.1@eisner>, bowler@eisner.decus.org writes:
> I'm trying to write a function that will transform an arbitrary array by taking
> hte natural log of every element in the array.
>
> What I have is
>
> function xform, input
> temp = alog(input) ; I realize I could combine these 2 statements
> return, temp ; but it makes debugging easier
> end
>
> Unfortunately, I can't guarentee that there won't be some elements that are
> zero and thus invalid arguments to alog. what's the "most efficient" way to
> take the alog of any element that's greater than 0 and set the value of ony
> that are less than or equal to 0 to some small value (1e-7 for example)?
>
Just do
function xform, input
eps = ..some small value here, can make it input parameter too ..
temp = alog(input > eps) ; I realize I could combine these 2 statements
return, temp ; but it makes debugging easier
end

Mati Meron | "When you argue with a fool,
meron@cars.uchicago.edu | chances are he is doing just the same"
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Summary: failed call_external under Windows NT
Next Topic: Re: Surface normals with shade_volume

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

Current Time: Fri Oct 10 14:35:38 PDT 2025

Total time taken to generate the page: 1.41295 seconds