Singular Value Decomposition of a Matrix

DESCRIPTION:
Computes singular values and (optionally) singular vectors of a matrix.

USAGE:
svd.Matrix(x, vectors, tune, workspace)

REQUIRED ARGUMENTS:
x:
numeric or complex Matrix inheriting from class "Matrix". NAs not allowed.

OPTIONAL ARGUMENTS:
vectors:
either a logical value telling whether or not to compute singular vectors, a logical vector of length 2 telling whether or not to compute the left and right singular vectors, respectively, or a numeric vector indicating the number of singular vectors to be computed. If this number is strictly between 0 and the corresponding dimension of x, then min(dim(x)) singular vectors will be computed. The default is to return min(dim(x)) left singular vectors and min(dim(x)) right singular vectors.
tune:
a integer vector or list of named tuning parameters that may affect computational efficiency. The relevant parameters are NB, NBMIN, NX, and NXSVD, as described in .laenv. The default is to use the settings in .laenv, which are initialized in S-Plus but may be changed by the user.
workspace:
workspace provided to the underlying software. The default is to use the minimum allowed value. The optimal workspace for the problem (for the given tune specifications) is included as part of the output attributes.

VALUE:
The result is an object of class c( "svd.Matrix", "decomp"). Attributes include the dimensions of the underlying matrix and a flag indicating whether or not the matrix is complex (this information is lost if no singular vectors are requested), as well as workspace information and a copy of the call to svd.Matrix.

DETAILS:
Based on the functions dgesvd and zgesvd from LAPACK (Anderson et al. 1994). In order for x to be recovered from the SVD, the number of left and right singular vectors need not exceed the minimum dimension of x. Parameters in tune may affect performance and workspace requirements, but the optimal settings are both machine and problem dependent. Users may want to experiment with tune (see Anderson et al., p. 72-74) to obtain improved performance.

BUGS:
The alleged optimal workspace can be smaller than the minimum allowed workspace.

REFERENCES:
Anderson, E., et al. (1994). LAPACK User's Guide, 2nd edition, SIAM, Philadelphia.

SEE ALSO:
svd.Matrix.object , qr.Matrix , eigen.Matrix

EXAMPLES:
 A <- Matrix( rnorm(60), nrow = 12, ncol = 5)
 svd.A <- svd(A)                        # SVD of A
 rcond(svd.A)                           # reciprocal condition number of A
 b <- rnorm(12)
 solve(svd.A,b)                         # least-squares solution to Ax = b