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

Home » Public Forums » archive » Where vs Histogram vs ??
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: Where vs Histogram vs ?? [message #32655 is a reply to message #32526] Wed, 23 October 2002 15:31 Go to previous message
Andrew Cool is currently offline  Andrew Cool
Messages: 219
Registered: January 1996
Senior Member
"Pavel A. Romashkin" wrote:
>
> Hi Andrew,
> Sorry for delaying the answer.
> No, no, no. No. It needs to be just what it is. It will be an array of
> just 9 pointers. Each of them points to a vector (well, except for the
> last one which is a matrix), and as such is searchable quite quickly
> using WHERE.
> You may notice that for an array of structures:
>
> a = {a: 0, b: 0.0, c: fltarr(5)}
> a = replicate(a, 1000)
> help, a.(0)
> ;<Expression> INT = Array[1000]
> help, a.(2)
> ;<Expression> FLOAT = Array[5, 1000]
>
> Therefore, when you loop over just *fields* of a structure array, you
> get the contents of the entire array. In your case, this is perfect for
> indexing the data. I use this a lot - it allows to shift arrays
> throughout the entire structure array just as if it were a plain matrix
> or vector, and is just as fast.
> As I said, you can basically do away with the sreucture array becasue
> now your 9-element pointer array contains everything the old structure
> array contained. In fact, yopu can dump the old array do free up some
> RAM, but that is not critical. Also, in a general case, you want only to
> include those fields in the ptr array that you use for searching, and
> then use the resulting index to extract the data from the original
> structure array.
> Regarding memory use:
>
> ; Here, A is an array of structures of exactly your type of size 16 mln.
> ; I have nothing else in the IDL session.
> IDL> help, /mem
> heap memory used: 512482366, max: 512483544, gets: 1719, frees:
> 1167
> IDL> ind = ptrarr(n_tags(a)
> IDL> for i = 0, n_tags(a)-1 do ind[i] = ptr_new(a.(i))
> ; The above takes less than a minute
> IDL> help, /mem
> heap memory used: 1024484012, max: 1024484732, gets: 3656, frees:
> 3093
>
> As expected, the memory use doubles; if that's a problem, discard the
> original array.
>
> Hope this helps.
> Pavel



Hi Pavel,


I doubt that I'd be able to hold both the structure and ptrarr in
memory
at any one time - our VMS SYSMAN1 would have conniptions if I asked to
increase my user quotas anymore - as it is I totally hog one Alpha
server
when this code runs...

But you seem pretty sure of your onions on this. I'll give it a whirl
and
to see if Pavel > Stein Vidar!


Thanks,

Andrew

------------------------------------------------------------ -----------------
Andrew D. Cool .->-.
Electromagnetics & Propagation Group '-<-'
Intelligence, Surveillance & Reconnaissance Division Transmitted on
Defence Science & Technology Organisation 100% recycled
PO Box 1500, Edinburgh electrons
South Australia 5111

Phone : 061 8 8259 5740 Fax : 061 8 8259 6673
Email : andrew.cool@dsto.defence.gov.au
------------------------------------------------------------ -----------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Finding the mean of a set of images
Next Topic: slice of 2D surface

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

Current Time: Sat Oct 18 13:49:25 PDT 2025

Total time taken to generate the page: 1.04452 seconds