svdcpp {lrstat} | R Documentation |
Singular Value Decomposition of a Matrix
Description
Computes the singular-value decomposition of a rectangular matrix.
Usage
svdcpp(X, outtransform = 1L, decreasing = 1L)
Arguments
X |
A numeric matrix whose SVD decomposition is to be computed. |
outtransform |
Whether the orthogonal matrices composing of the left and right singular vectors are to be computed. |
decreasing |
Whether the singular values should be sorted in decreasing order and the corresponding singular vectors rearranged accordingly. |
Details
Given A \in R^{m\times n} (m \geq n)
, the following algorithm
overwrites A
with U^T A V = D
, where
U\in R^{m\times m}
is orthogonal, V \in R^{n\times n}
is
orthogonal, and D \in R^{m\times n}
is diagonal.
Value
A list with the following components:
-
d
: A vector containing the singular values ofX
. -
U
: A matrix whose columns contain the left singular vectors ofX
. -
V
: A matrix whose columns contain the right singular vectors ofX
.
Author(s)
Kaifeng Lu, kaifenglu@gmail.com
References
Gene N. Golub and Charles F. Van Loan. Matrix Computations, second edition. Baltimore, Maryland: The John Hopkins University Press, 1989, p.434.
Examples
A <- matrix(c(1,0,0,0, 1,2,0,0, 0,1,3,0, 0,0,1,4), 4, 4)
svdcpp(A)