Column vector matrix creation from PC image [message #76703] |
Wed, 22 June 2011 04:05 |
Lavanya
Messages: 7 Registered: August 2010
|
Junior Member |
|
|
Hi,
I am trying to create a column vector of the form
E = [[ 1, 1, 1, ......1], [e1,e2, .... ep], ......[e1(n),
e2(n)....ep(n)]]
where the first row values are one, p user input values. Now i need to
fill the matrix with random values that are obtained from an PC
image.
Here is the code for reference:
covMatrix = Correlate(image11, /COVARIANCE, /DOUBLE)
eigenvalues = EIGENQL(covMatrix, EIGENVECTORS=eigenvectors, /DOUBLE)
Print, eigenvalues
Print, 'First Component (%): ', eigenvalues[0]/Total(eigenvalues)*100
for i=0, bands-1 do begin;
pc = eigenvectors ## Transpose(image11)
pc1[*,*,i] = Reform(pc[*,i], rows, cols)
; pc1[*,*,i] = Reform(temporary(pc[*,i]), dims[0], dims[1],4)
endfor
p = 30
TestMatrix = fltarr(p,p)
TestMatrix(*,0) = 1
idx1 = fltarr(1,p)
;data = pc(*,p-1)
for i=0,p-1 do begin
seed = 100L
idx = floor(randomu(seed,p)) + 1
TestMatrix(1:p,*) = pc(idx,*) ; error at
this place
idx1(i) = idx;
endfor
Finally, i need to construct TestMatrix
|
|
|