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

Home » Public Forums » archive » Re: quickly totaling sections of an array
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: quickly totaling sections of an array [message #52556 is a reply to message #52554] Tue, 13 February 2007 07:25 Go to previous message
Conor is currently offline  Conor
Messages: 138
Registered: February 2007
Senior Member
Hmm... I found sample code here: http://www.dfanning.com/code_tips/
drizzling.html
that claims to do the job, but that doesn't work. The first problem
is that n_ind isn't defined. I set that to n_elements(h1)+1 and then
ran again. Then I got this:
% SPRSIN: Vector must have 6 elements: <FLOAT Array[3]>

Anyone happen to know what's going on here, or have a better
suggestion?

On Feb 13, 10:05 am, "Conor" <cmanc...@gmail.com> wrote:
> Hey Everyone,
> I'm essentially trying to add together separate sections of an
> array, and I need to do it in a very speedy fashion. Here's the
> breakdown in IDL. I would want to take an array like this:
>
> vals = [10, 15, 13, 12, 11, 14]
>
> and imagine I have a mask (which I can easily make) like this:
>
> mask = [ 0, 0, 0, 1, 1, 1 ]
>
> I would then want to add together everything with the same mask value
> and put it in a new array. So the result would be:
>
> sums = [38, 37]
>
> I'm generating images, and for each image I generate this will be done
> 1000 times, and there will be 1000 different mask values each time it
> is done. I'll be generating a couple hundred images, so I'll be
> running this task a couple hundred thounsand times - i.e. execution
> speed is very important. Any suggestions on how to speed things up
> would be highly appreciated.
> Thanks in advanced,
> Conor
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: quickly totaling sections of an array
Next Topic: Curiosity only: assigning array de-fragments memory?

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

Current Time: Sat Oct 11 19:43:12 PDT 2025

Total time taken to generate the page: 0.24710 seconds