Learn R Programming

psvd (version 1.0-0)

eigenVc: Compute the eigenvectors of a square symmetric matrix

Description

This is an internal function which uses a C 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

eigenVc(xmat, wp, d, r, 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.

d

Number of rows of wp.

r

Number of columns of wp.

itmax

Maximum number of iterations.

err

Tolerance level in the iterative search.

Examples

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

Run the code above in your browser using DataLab