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

Home » Public Forums » archive » Concatenating arrays - speed issues?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Concatenating arrays - speed issues? [message #76481] Tue, 07 June 2011 08:48
rjp23 is currently offline  rjp23
Messages: 97
Registered: June 2010
Member
Hi

This is a pretty basic question but I'm trying to speed up some code
and at the minute it's quite ugly and does this:

1) Loop over input data
2) Perform some calculations based on input data which may or may not
produce a result we want to use
3a) If a result is produced and it's the first time within the loop,
create an array to hold it
3b) If a result is produced but it's not the first time within the
loop, concatenate the result to the array that's already been created.


I'm doing the concatenation with something like:

array = [[array],value]

Now this works fine but as we get more input data it seems the
concatenation is becoming quite slow (presumably as the arrays are
getting larger and larger).

The alternative I guess would be to define an array at the start with
some arbitrarily large size, subscript the values to it and then check
at the end to trim empty elements but that doesn't seem much nicer and
in this case estimating an arbitrary size isn't that straight-forward.

Is there an "IDL way" way to do this?

Cheers
[Message index]
 
Read Message
Previous Topic: Re: Major ticks is exceeds the plotting window
Next Topic: interpolate large numbers

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

Current Time: Thu Oct 09 22:38:26 PDT 2025

Total time taken to generate the page: 0.24133 seconds