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

Home » Public Forums » archive » Re: Code optimization
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: Code optimization [message #75139 is a reply to message #75134] Wed, 16 February 2011 13:48 Go to previous messageGo to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Wednesday, February 16, 2011 4:25:39 PM UTC-5, kisCA wrote:
> Jeremy, I understand your disappointment about the subscript in the
> loops, but it's a code I get from a collegue who I suppose wrote it in
> Fortran and then just translate it in IDL.

Yeah, it definitely has that look to it. ;-)

> Jeremy, also, could you explain me a bit more the difference between
> [] and ().
> cov, cs, var_factor are variables.
> I am sorry I just moved to idl 3 month ago from matlab and I really
> have difficulty with "the subscript game" going on here...
> Thanks

No problem! A Long Time Ago, IDL used () for both function calls and array subscripts. But that's not a good idea, since it leads to ambiguity not just in reading code but also in executing it (what happens if you have both a variable and function with the same name?). So [] was introduced for array subscripts. Now you can use either by default, but [] is much preferred.

If you use compile_opt idl2, then you can *only* use [] (as well as a few other useful changes).

-Jeremy.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Resizeable Graphics Windows for Traditional Commands
Next Topic: make strsplit not skip null between patterns

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

Current Time: Fri Oct 10 15:02:33 PDT 2025

Total time taken to generate the page: 0.08050 seconds