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

Home » Public Forums » archive » Re: JBIU utilities - release 1.0
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: JBIU utilities - release 1.0 [message #60803 is a reply to message #60802] Fri, 13 June 2008 11:39 Go to previous messageGo to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On Jun 13, 10:44 am, Brian Larsen <balar...@gmail.com> wrote:
> Oddly I opened up sign() and in the spirit of Coyote's IDL way I have
> previously written sign() without the nasty for loop.  This rewrite
> gained a x12.6 improvement in speed for my test case.
>
> function sign, in
>     pos = make_array(n_elements(in), /byte, value = 1)
>     zero = in EQ 0
>     neg = in LT 0
>     pos = pos - zero
>     pos = pos - 2 * neg
>     return, pos
> END

How about the following?

function mg_sign, x
compile_opt strictarr

return, fix(x gt 0) - fix(x lt 0)
end

Mike
--
www.michaelgalloy.com
Tech-X Corporation
Software Developer II
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Warping with intensity conservation or drizzle algorithm
Next Topic: JBIU utilities - release 1.0

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

Current Time: Sat Oct 11 09:38:06 PDT 2025

Total time taken to generate the page: 0.48338 seconds