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

Home » Public Forums » archive » Accelerating "for "loops
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
Accelerating "for "loops [message #72946] Thu, 14 October 2010 06:31
Regine is currently offline  Regine
Messages: 1
Registered: October 2010
Junior Member
Hello,
I need to know if there's a way to make this code go faster as I am
using very large arrays.
the code is :
nTab=15296820
n_Tag1=5925470
n_Tag2= 2478581
n_Tag3=6892766
FinalTable=make_array(nTab)

;Indice_tag1, Indice_tag2 and Indice_Tag3 are arrays of size n_Tag1,
n_Tag2 and n_Tag3 respectively

for i=0L,nTab-1 do begin
for j=0L,n_Tag1-1 do begin
for k=0L,n_tag2-1 do begin
for l=0L,n_tag3-1 do begin
if i eq Indice_Tag1[j] then begin
FinalTable[i]=Tag1[j]
Endif
if i eq Indice_tag2[k] then begin
FinalTable[i]=tag2[k]
endif
if i eq Indice_tag3[l] then begin
FinalTable[i]=tag3[l]
endif
endfor
endfor
endfor
endfor

END

Thank you in advance for any help that you can provide,

Cheers,
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Random Sampling Without Replacement
Next Topic: Re: Accelerating "for "loops

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

Current Time: Wed Oct 08 15:37:28 PDT 2025

Total time taken to generate the page: 0.00567 seconds