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

Home » Public Forums » archive » about replicate_inplace
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
about replicate_inplace [message #35902] Tue, 22 July 2003 13:37
xje4e is currently offline  xje4e
Messages: 18
Registered: February 2002
Junior Member
Hi, there,

I am really puzzled by the IDL usage of memory. Here is an example:

T = systime(1)
b = bytarr(nreg, nreg)
print, systime(1) - T, ' seconds.'

T = systime(1)
replicate_inplace, b, 0
print, systime(1) - T, ' seconds.'

In the example, the first part is to create an array with values 0.
The second part is to assign each element in the array the value 0.
The running time for the first part is 0.12sec, while the running time
for the second part is 0.37sec.

My question is: since the first part needs to allocate the memory and
assign values to elements, it should take longer time than the second
part. In IDL help, it says: "REPLICATE_INPLACE can be faster and use
less memory than the IDL function REPLICATE or the IDL array notation
for large arrays that already exist. " However, why the first part
takes less time?

If this is really the case in IDL, then it's better to allocate a new
array than to use the current array. It's really strange for me.

Any suggestion?

Xiaoying
[Message index]
 
Read Message
Previous Topic: Re: WHERE problems (longish)
Next Topic: Re: Variable assignment

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

Current Time: Wed Oct 08 18:25:08 PDT 2025

Total time taken to generate the page: 0.00430 seconds