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

Home » Public Forums » archive » uniq slow for loop
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
uniq slow for loop [message #67270] Thu, 16 July 2009 14:52
newerjazz is currently offline  newerjazz
Messages: 5
Registered: July 2009
Junior Member
Hi All,

I have an array of [9,1,000,000]. In one of the columns are sorted
numbers (eg. 0,1,1,2,3,3,3,3,3,4,4,5,5,5,6,7,7,7,etc). I want to pick
out all the rows where column 9 is equal to some number and average
all the quantities in those rows.

Right now I use a for loop and the where function to pick out these
rows. This is of course very slow. Anyway to increase the speed of
this would be greatly appreciated. Thank you very much!

Cheers,
newerjazz

nmax = max(data(8,*))
FOR j=0, nmax DO BEGIN
w=where(data(8,*) eq j, nw)
blah=mean(data(*,w))
etc,etc
ENDFOR
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: array convol optimizationv slow now
Next Topic: discover SDS of HDF with GUI

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

Current Time: Wed Oct 08 19:55:15 PDT 2025

Total time taken to generate the page: 0.01482 seconds