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 
Return to the default flat view 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
[Message index]
 
Read Message
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: Sat Oct 11 16:11:46 PDT 2025

Total time taken to generate the page: 1.68208 seconds