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

Home » Public Forums » archive » correlation matrix
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
correlation matrix [message #35323] Wed, 11 June 2003 12:04 Go to previous message
kevinlausten is currently offline  kevinlausten
Messages: 6
Registered: April 2003
Junior Member
I have written code to create the correlation matix of a data cube,
however, it seems to run slower than I would expect. I am I doing
anything inefficiently?

for r = 0, (nrows-1) do begin
for c = 0, (ncols-1) do begin
;sum = 0
for bb = 0, (nbands-1) do begin
ref(bb) = in_cube(bb, c, r)
; 'ref' equals 'back_cube' for all values of 'bb' at location
; (c, r)
endfor
;print, ref
temp = ref#transpose(ref)
; 'temp' equals the product of 'ref' and the transpose of 'ref'
sum = sum + temp
; 'sum' is a running total of the value of 'temp' at location
; (c, r)
endfor
endfor
final0 = fltarr(nbands, nbands)
; 'final0' is a floating point aray of size (nbands, nbands)
n = npixels
; 'n' is a variable equal to 'npixels'
final0= sum/n
; final0 is correlation matrix
Thanks
Kevin
[Message index]
 
Read Message
Read Message
Previous Topic: Redirect STDOUT
Next Topic: IDL and DODS (OpenDAP) data?

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

Current Time: Sun Oct 12 14:10:49 PDT 2025

Total time taken to generate the page: 1.20543 seconds