LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2009, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 18 Feb 2009 22:00:05 -0500
Reply-To:     Ken Borowiak <evilpettingzoo97@AOL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ken Borowiak <evilpettingzoo97@AOL.COM>
Subject:      Re: eigenvalues in proc iml

On Wed, 18 Feb 2009 11:28:56 -0600, ./ ADD NAME=Data _null_; <iebupdte@GMAIL.COM> wrote:

>D = diag(eigval(C)); > > >On 2/18/09, Zach Peery <zpeery@nature.berkeley.edu> wrote: >> Hi All, >> >> I have a 3x3 matrix called C and want a matrix D with eigenvalues of C on >> the diagonal. But the "eigen" function only gives me eigenvalues in a 3 >> element vertical vector. >> >> In other words the following commands: >> >> proc IML; >> C = {1 0.3 0.2, 0.3 1 0.6, 0.2 0.6 1}; >> D = eigval(C); >> print D; >> run; >> >> yields: >> 1.76 >> 0.84 >> 0.39 >> >> but I want: >> 1.76 0 0 >> 0 0.84 0 >> 0 0 0.39 >> >> Any help is greatly appreciated... >>

It is hard to beat the succinctness of DIAG(). Nevertheless, an alternative:

proc IML; C = {1 0.3 0.2, 0.3 1 0.6, 0.2 0.6 1}; D = eigval(C); print c;

E=I(nrow(D)) # D ; print E ;

quit ;

Regards, Ken


Back to: Top of message | Previous page | Main SAS-L page