Newsgroups: comp.lang.idl-pvwave
From: Dick Jackson <d...@d-jackson.com>
Date: Wed, 7 Nov 2012 18:37:10 -0800 (PST)
Local: Wed, Nov 7 2012 9:37 pm
Subject: Re: use of temporary in IDL
Rohit,
Indexing using the [*, *, sorted_z] creates a list of indices with a 4-byte value for each element, leading to that huge memory usage. In this case, making a second copy (perhaps unavoidable), then looping over one dimension ends up using far less memory and taking less time. (Sometimes a loop is OK, especially when one statement still operates on 4 million elements!):
PRO IndexingTest
nPlanes = 287
vol = IntArr( 512, 512, nPlanes )
;; Method 1:
duration1 = SysTime(/Seconds)-t0
vol = IntArr( 512, 512, nPlanes )
;; Method 2:
duration2 = SysTime(/Seconds)-t0
Help, duration1, duration2, memUsedMB1, memUsedMB2
END ;; IndexingTest
Output:
IDL> indexingtest
Perhaps you could avoid making the copy of the array if you knew what sequence of swapping planes of your array would lead to the desired sorted_z... left as an exercise for the reader :-)
Cheers,
On Tuesday, November 6, 2012 8:05:13 AM UTC-8, rohit bhat wrote:
> Hi, > I had a question regarding the use of temporary in IDL.
> I wanted to re-order a 3D array.
> Suppose the array is vol = IntArr( 512, 512, 287 )
> I sorted the Z dimension and got the indices. The command I then used was > vol = temporary( vol[ *, *, sorted_z] ) > Despite this, the memory used is still the same if I don’t use temporary (almost 5 times the size of the array)
> Is this the correct way to use temporary? If I am using it correctly, is it just the IDL way of reading columns and rows?
> Thanks,
> Rohit
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||