svd
Singular Value Decomposition of a Matrix

### Description

Returns a list that contains the singular value decomposition of the input.

### Usage

    svd(x, nu = min(dim(x)), nv = min(dim(x)), LINPACK = FALSE)
    La.svd(x, nu = min(n, p), nv = min(n, p))

### Arguments

x | a matrix of numeric or complex data. svd will attempt to convert a non-matrix to a matrix by calling as.matrix. x must not contain missing values (NAs) or non-finite values.
nu | an integer that specifies the number of columns of the u matrix to return. This is generally 0, ncol(x), or nrow(x).
nv | an integer that specifies the number of columns for the v matrix. This is generally 0, ncol(x), or nrow(x).
LINPACK | This argument is ignored. Lapack routines are used to compute the decomposition.

### Details

The decomposition is computed by the Lapack routines dgesvd (double precision case) and zgesvd (complex case).
Value
returns a list containing the components of the singular value decomposition:

x = u %*% diag(d) %*% t(v)

or more efficiently:

x = u %*% (d * t(v)).

In the complex case:

x = u %*% diag(d) %*% Conj(t(v))

The names of the components are:

d | a vector of singular values, in non-increasing order, that represent the diagonal elements of the matrix x.

u | if nu > 0, a matrix with dimensions nrow(x) by nu of unit orthogonal columns. Not present in La.svd and NULL in svd if nu = 0.

v | if nv > 0, a matrix with dimensions ncol(x) by nv of unit orthogonal columns. Not present in La.svd and NULL in svd if nu = 0.

For La.svd the return value instead contains vt, the transpose of v.
Background
The singular value decomposition decomposes a matrix (x) with the dimensions n by p into two orthogonal matrices and a diagonal matrix.
The squares of the singular values of x are the eigenvalues of t(x) %*% x. In the complex case, they are the eigenvalues of Conj(t(x)) %*% x.
You can use the singular value decomposition as a numerically stable way to perform many multivariate statistics operations. For example, deciding the "rank" of a matrix is one task that has been suggested for the decomposition. The "rank" of a matrix is an ill-defined numerical concept and tends to depend on the task at hand. Some hold that the QR decomposition is as good or better than the singular value decomposition at deciding the rank in some situations.
References
Golub, G.H. and Van Loan, C.F. (1983). Matrix Computations. Baltimore: Johns Hopkins University Press.
Thisted, R.A. (1988). Elements of Statistical Computing: Numerical Computation. New York: Chapman and Hall.
See Also
chol, eigen, matrix, qr
Examples

    amat <- matrix(1:9, 3, 3) # create a 3 by 3 matrix
    sva <- svd(amat)
    asqrt <- t(sva$v %*% (t(sva$u) * sqrt(sva$d))) #  a squareroot of amat

Package base version 6.1.5-18
Package Index