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

Home » Public Forums » archive » Re: How to rebin complex 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: How to rebin complex array? [message #39011] Wed, 14 April 2004 13:01 Go to previous message
Yunxiang Zhang is currently offline  Yunxiang Zhang
Messages: 19
Registered: October 2003
Junior Member
Folks,

I did some test to rebin a complex array. Thanks for all you guys' help!:)

speed test result: a for loop is not as worse as I would imagine in
this case.

"#" > "for loop" > "special rebin" > "component rebin"

for loop 0.25066495
component rebin 0.53236008
special rebin 0.37491202
# 0.16867399

I also found using fltarr is better than using replicate
fltarr > replicate

replicate 0.039183140
fltarr 0.027969122

;here's my testing code
aa=bytscl(reform(ran2_normal(-738345,dim=5000),2,2500))
a=reform(complex(aa[0,*],aa[1,*]))

na=n_elements(a) & k=na

;using for loop
t0=systime(1)
b1=complexarr(na,k)
for i=0,k-1 do begin
b1[*,i]=a
endfor
print, 'for loop', systime(1)-t0

;using component rebin
t0=systime(1)
ra=real_part(a)
ia=imaginary(a)
rb=rebin(ra,[na,k])
ib=rebin(ia,[na,k])
b2=complex(rb,ib)
print,'component rebin', systime(1)-t0

;i call it special rebin, please refer to Peter's post
t0=systime(1)
d=double(a,0,k)
r=rebin(temporary(d),na,k,/sample)
b3=complex(temporary(r),0,na,k)
print,'special rebin', systime(1)-t0

;using #
t0=systime(1)
b4=a#(1+fltarr(k))
print,'#', systime(1)-t0


t0=systime(1)
for i=0,1000 do aaa=replicate(1.,10000)
print,'replicate', systime(1)-t0

t0=systime(1)
for i=0,1000 do bbb=1+fltarr(10000)
print,'fltarr', systime(1)-t0

end
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: reading pixels from images from automated XYpositions
Next Topic: Re: Read & write data files b/w IDL & Fortran 90

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

Current Time: Wed Oct 08 13:41:48 PDT 2025

Total time taken to generate the page: 0.00479 seconds