calcSVD {psvd} | R Documentation |
Perform singular values decomposition
Description
Given a data matrix, the function allows to perform a singular decomposition using a power method and relationship between SVD factors and the eigendecomposition factors.
Usage
calcSVD(X, r, eta, itmax, err,mySeed)
Arguments
X |
Data matrix of size (m,n), m >= n. |
r |
Rank r approximation, default: r=2. |
eta |
Power method tuning parameter, default: eta=10. |
itmax |
Maximum number of iteration in the power method, default: itmax=200. |
err |
Tolerance level in the power method, default: err=1e-8. |
mySeed |
An integer allowing to reproduce results from two different runs, default: mySeed=50. |
Details
X is usually a data matrix.
Value
This function returns a data frame containing 4 components
d |
Singular values. |
u |
Matrix with the right eigenvectors. |
v |
Matrix with the right eigenvectors. |
iter |
The number of iterations used in the eigendecomposition. |
Examples
data(iris)
X <- as.matrix(iris[,1:4])
rownames(X) <- iris[,5]
res <- calcSVD(X, r=3)
res$d
res$v
res$iter
[Package psvd version 0.1-0 Index]