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

Home » Public Forums » archive » Array concatenation
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: array concatenation [message #62811 is a reply to message #48962] Fri, 03 October 2008 14:16 Go to previous messageGo to previous message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
On 3 oct, 17:15, Joost Aan de Brugh <joost...@gmail.com> wrote:
> On Oct 3, 1:19 pm, lecacheux.al...@wanadoo.fr wrote:
>
> Hello,
>
> Maybe it has something to do with the array descriptor. Anyway, in a
> large group concatenation is not the most elegant way. In Matlab (a
> language similar to IDL), you get a warning if you use such a
> construction. It has to do with the fact that if your array grows, you
> ask your system for more space. A safer way is to ask for enough space
> at once.
>
> afh = a few 100
>
> b = BytArr(afh*1000) ; Here is where you ask for a lot of space.
> for i=0,999 do begin
>   ... compute a = array of bytes (a few 100) ...
>   b[i*afh:(i+1)*afh-1] = a ; Now b does not grow in the loop
> end
>
> Or use a 2D array
>
> b = BytArr(afh,1000) ; Here, you ask for the space again.
> for i=0,999 do begin
>   ... compute a = array of bytes (a few 100) ...
>   b[*,i] = a ; Now b does not grow in the loop
> end
>
> Cheers,
> Joost
>
> b = Reform(b,afh*1000) ; Or b = Reform(b,N_Elements(b))
>
> It is a bit harder if you have different 'a few 100's for each
> iteration

Thanks for your reply. I agree with you that such a programming style
is far from ideal.
My point is that it likely can produce some not obvious array boundary
error (and subsequent IDL crash),
while largest used array sizes remain far below the maximum authorized
one.
Or I missed something ?
alx.
[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
Previous Topic: Re: IDL slow to load command prompt
Next Topic: The usage of PS_END

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

Current Time: Wed Oct 08 15:15:46 PDT 2025

Total time taken to generate the page: 0.00445 seconds