[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Was: Index... Now: Vectorize, huh?
- Subject: Was: Index... Now: Vectorize, huh?
- From: "Pavel A. Romashkin" <pavel.romashkin(at)noaa.gov>
- Date: Thu, 05 Apr 2001 13:24:25 -0600
- Newsgroups: comp.lang.idl-pvwave
- Organization: NOAA-CMDL-CIRES
- References: <3ACBABB3.A5DD07B7@noaa.gov>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:24411
Craig and Med,
I appreciate it! This is exactly what I needed. My problem is the lack
of matrix operations knowledge. Craig's generic solution is exactly what
I expected to see from Craig :-)
By the way. We all are big on vectorizing things in IDL. But look at this:
IDL> a = test(2000)
1.4968959
IDL> a = test(2000, /v)
3.2976190
where TEST is below. I don't even mention that /VEC causes extremely
high memory usage and gets totally out of hand on my system if S > 5000
or so.
;******************************
pro test, s, vec=vec
start = systime(1)
x = findgen(s)
a = fltarr(s, s)
if keyword_set(vec) then begin
a = sqrt(transpose(rebin(x, s, s))^2 + rebin(x, s, s)^2)
endif else begin
for i = 0, s-1 do begin
a[0, i] = sqrt(x^2 + i^2.)
endfor
endelse
print, systime(1) - start
;return, a
end
;******************************