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

Home » Public Forums » archive » Re: Most Common IDL Programming Errors
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: Most Common IDL Programming Errors [message #59812 is a reply to message #59735] Wed, 09 April 2008 09:31 Go to previous messageGo to previous message
Kenneth P. Bowman is currently offline  Kenneth P. Bowman
Messages: 585
Registered: May 2000
Senior Member
In article <MPG.22666eb3ce01c4fd98a324@news.frii.com>,
David Fanning <news@dfanning.com> wrote:

> Kenneth P. Bowman writes:
>
>> David, I have some EOF code that is only a few lines long if you want it
>> (using LA_EIGENQL).
>
> Yes, thank you. We are having difficulties determining which
> is the "correct" implementation around here. We are going
> to take a vote later today. I could use more ammunition. :-)
>
> Cheers,
>
> David

I believe this code fragment is correct. �;-)

The input array 'values' is an nvar x nt (number of times) observation matrix.

This code first calculates the nvar x nvar covariance matrix 'cov' by using
MATRIX_MULTIPLY. For large data sets you may want to compute
the covariance matrix out of memory.

The eigenvalues and eigenvectors are found using LA_EIGENQL. The code
calculates the first 'nev' eigenvalues and eigenvectors of the
covariance matrix. (I say first because we normally sort the
eigenvalues from largest to smallest. LA_EIGENQL does the reverse, so
actually it is the last 'nev' eigenvalues, hence the calls to REVERSE.)


cov = MATRIX_MULTIPLY(values, values, /BTRANSPOSE)/nt ;Compute covariance matrix
eigenval = LA_EIGENQL(cov, EIGENVECTORS = eigenvec, $ ;Compute eigenvalues and eigenvectors
RANGE = [nvar - nev, nvar-1])
eigenval = REVERSE(eigenval) ;Sort eigenvalues from largest to smallest
eigenvec = REVERSE(eigenvec, 2) ;Sort eigenvectors as eigenvalues


Cheers, Ken
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Reading HTML (web) page through socket
Next Topic: Re: delvar, all

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

Current Time: Wed Oct 08 19:35:49 PDT 2025

Total time taken to generate the page: 0.00620 seconds