Learn R Programming

psvd (version 1.0-0)

eigenV: Compute the eigenvectors matrix of a square symmetric matrix

Description

This is an internal function which uses a R code to calculate an eidendecomposition of a square symmetric matrix. This function is used in the power method allowing to compute singular values and principal component analysis.

Usage

eigenV(xmat, wp, itmax, err)

Value

This function returns a data frame containing 2 components

wc

Eigenvectors matrix.

iter

Number of iterations by the power method.

Arguments

xmat

Square symmetric matrix of order d.

wp

Columns orthogonal matrix of size (d,r), r <= d.

itmax

Maximum number of iterations.

err

Tolerance level in the iterative search.

Examples

Run this code
d <- 3
w <- matrix(rnorm(d*d,0,1), ncol=d)
wp <- mGS(w)
XtX <- matrix(c(3,2,1,2,1,0,1,0,1), ncol=3)
res <- eigenV(XtX, wp, itmax=100, err=1e-8)
t(res$wc) 

Run the code above in your browser using DataLab