help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

IDL's temporary() function


From: Judd Storrs
Subject: IDL's temporary() function
Date: Tue, 22 Apr 2008 12:04:13 -0400

Hi all,

I'm coming back to using octave after spending a few years working primarily in IDL. IDL has a very nice "temporary" function for "disowning" a variable so that it won't be copied when written.

From the IDL online help at http://idlastro.gsfc.nasa.gov/idl_html_help/TEMPORARY.html

"The TEMPORARY function returns a temporary copy of a variable, and sets the original variable to "undefined". This function can be used to conserve memory when performing operations on large arrays, as it avoids making a new copy of results that are only temporary. In general, the TEMPORARY routine can be used to advantage whenever a variable containing an array on the left hand side of an assignment statement is also referenced on the right hand side."

This means that in IDL rewriting "a = 5*a + 1" as "a = 5*temporary(a)+1" avoids duplicating the contents of a.

Does octave already have similar functionality? If not will this approach be compatible with octave's interpreter? Any pointers on where I should start for adding this?

Thanks,

--judd

reply via email to

[Prev in Thread] Current Thread [Next in Thread]