[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Vectorization question



Liam E. Gumley, Liam.Gumley@ssec.wisc.edu writes:

> How would I vectorize the following operation
>
> for i = 0, n_elements(x) - 1 do a[x[i]] = a[x[i]] + b[i]
	
	I've often wondered if IDL could be modified internally to allow
an implicit loop where the loop variable is only used for indexing
arrays.  I've hit several situations where I want to do this sort of
thing, but don't want to write external routines and don't have the
memory to use the 2D trick.

    Oh well.
    

Struan
PS: I tried hard to use HISTOGRAM, but just ended up looping
through the reverse indices array, which a priori is no faster.