[R] spectral-decomposition

Jonathan Rougier J.C.Rougier at durham.ac.uk
Mon Jan 22 17:54:24 CET 2001


On Mon, 22 Jan 2001, Tapio Nummi wrote:

> I try to make the spectral decomposition
> for the following matrix by utilising the
> function eigen.
> 
>   0.4015427  0.08903581 -0.2304132
>   0.08903581 1.60844812  0.9061157
> -0.23041322 0.9061157   2.9692562
> 
> When checking the result I was not able
> to produce the original matrix by using
> the decomposition. It also appears that
> the product T'T, where T is a matrix of
> eigenvectors, is not an identity matrix.

Hi Tapio,

I'm not having your problems:

> A
            [,1]       [,2]       [,3]
[1,]  0.40154270 0.08903581 -0.2304132
[2,]  0.08903581 1.60844812  0.9061157
[3,] -0.23041320 0.90611570  2.9692562

> sdec <- eigen(A, symm=TRUE)

> t(sdec$vectors) %*% sdec$vectors     
              [,1]          [,2]          [,3]
[1,]  1.000000e+00 -1.665335e-16 -5.551115e-17
[2,] -1.665335e-16  1.000000e+00  2.428613e-16
[3,] -5.551115e-17  2.428613e-16  1.000000e+00

> sdec$vectors %*% diag(sdec$values) %*% t(sdec$vectors) - A
              [,1]          [,2]         [,3]
[1,] -5.551115e-17 -2.775558e-17 2.000000e-08
[2,] -5.551115e-17  1.998401e-15 8.881784e-16
[3,] -1.387779e-16  7.771561e-16 2.220446e-15

Cheers, Jonathan.

Jonathan Rougier                       Science Laboratories
Department of Mathematical Sciences    South Road
University of Durham                   Durham DH1 3LE
tel: +44 (0)191 374 2361, fax: +44 (0)191 374 7388
http://www.maths.dur.ac.uk/stats/people/jcr/jcr.html

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list