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

Home » Public Forums » archive » Re: which array dimensions are contiguous?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: which array dimensions are contiguous? [message #47521] Tue, 14 February 2006 02:51
greg michael is currently offline  greg michael
Messages: 163
Registered: January 2006
Senior Member
oops - that was the original question... don't bother to answer that!

greg
Re: which array dimensions are contiguous? [message #47522 is a reply to message #47521] Tue, 14 February 2006 02:31 Go to previous message
greg michael is currently offline  greg michael
Messages: 163
Registered: January 2006
Senior Member
Thanks, David. My question was really only about whether the first
dimensions of an array are the contiguous ones, to which I understand
the answer is yes. The indexing mess is different (and probably worse)
than the one I was imagining, so thanks for that, too.

Still, there's something in that article I couldn't grasp...

IDL> myArray = FltArr(3660, 1680)
IDL> indices = Randomu(seed, 100000) * 3660L * 1680L
IDL> myArray[indices, indices] = 5

I'd have understood if the 3rd line said myArray[indices] = 5. What's
going on here? Why doesn't it cause an error to put in a list of
indices which exceed the dimension?

IDL> print,max(indices)
6.14869e+006

I suppose they're being first enumerated into a single list, and then
being applied as 1-d subscripts? I wouldn't have said "No problems with
this. "!

regards,
Greg
Re: which array dimensions are contiguous? [message #47523 is a reply to message #47522] Mon, 13 February 2006 12:04 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
greg michael writes:

> I know somebody wrote this only recently, but I can't find it again. If
> the function below, EvaluateFunctionSection, returns a 2-d array
> (ns,nl), will assignment put it into contiguous memory, or make some
> kind of awful (slow?) mess?
>
> b=fltarr(ns,nl,n_elements(f))
> for i=1,n_elements(f) do begin
>
> b[*,*,i]=self-> EvaluateFunctionSection(f[i],ln,sm,nl,ns,downsample=downsamp le)
> endfor

It will make a (slow) mess. Do this, instead:

b[0,0,I]=self->EvaluateFunctionSection[I], $
ln,sm,nl,ns,downsample=downsample)

See this article:

http://www.dfanning.com/misc_tips/submemory.html

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: which array dimensions are contiguous?
Next Topic: weighted Gaussian distribution mean

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

Current Time: Fri Oct 10 16:29:10 PDT 2025

Total time taken to generate the page: 0.24167 seconds