|
NAG[f08mec] NAG[nag_dbdsqr] - SVD of real bidiagonal matrix reduced from real general matrix
|
|
Calling Sequence
f08mec(uplo, ncvt, d, e, vt, u, c, 'n'=n, 'nru'=nru, 'ncc'=ncc, 'fail'=fail)
nag_dbdsqr(. . .)
Parameters
|
uplo - String;
|
|
|
On entry: indicates whether is an upper or lower bidiagonal matrix.
|
|
is an upper bidiagonal matrix.
|
|
is a lower bidiagonal matrix.
|
|
Constraint: "Nag_Upper" or "Nag_Lower". .
|
|
|
ncvt - integer;
|
|
|
Constraint: . .
|
|
|
d - Vector(1..dim, datatype=float[8]);
|
|
|
Note: the dimension, dim, of the array d must be at least .
|
|
On entry: the diagonal elements of the bidiagonal matrix .
|
|
|
e - Vector(1..dim, datatype=float[8]);
|
|
|
Note: the dimension, dim, of the array e must be at least .
|
|
On entry: the off-diagonal elements of the bidiagonal matrix .
|
|
|
vt - Matrix(1..dim1, 1..dim2, datatype=float[8], order=order);
|
|
|
Note: this array may be supplied in Fortran_order or C_order , as specified by order. All array parameters must use a consistent order.
|
|
If , vt is not referenced.
|
|
|
u - Matrix(1..dim1, 1..dim2, datatype=float[8], order=order);
|
|
|
Note: this array may be supplied in Fortran_order or C_order , as specified by order. All array parameters must use a consistent order.
|
|
If , u is not referenced.
|
|
|
c - Matrix(1..dim1, 1..dim2, datatype=float[8], order=order);
|
|
|
Note: this array may be supplied in Fortran_order or C_order , as specified by order. All array parameters must use a consistent order.
|
|
On exit: is overwritten by the matrix . If , c is not referenced.
|
|
|
'n'=n - integer; (optional)
|
|
|
Default value: the dimension of the array d.
|
|
On entry: , the order of the matrix .
|
|
Constraint: . .
|
|
|
'nru'=nru - integer; (optional)
|
|
|
Default value: the first dimension of the array u.
|
|
Constraint: . .
|
|
|
'ncc'=ncc - integer; (optional)
|
|
|
Default value: the second dimension of the array c.
|
|
Constraint: . .
|
|
|
'fail'=fail - table; (optional)
|
|
|
The NAG error argument, see the documentation for NagError.
|
|
|
|
Description
|
|
|
Purpose
|
|
nag_dbdsqr (f08mec) computes the singular value decomposition of a real upper or lower bidiagonal matrix, or of a real general matrix which has been reduced to bidiagonal form.
|
|
Description
|
|
nag_dbdsqr (f08mec) computes the singular values and, optionally, the left or right singular vectors of a real upper or lower bidiagonal matrix . In other words, it can compute the singular value decomposition (SVD) of as
Here is a diagonal matrix with real diagonal elements (the singular values of ), such that
is an orthogonal matrix whose columns are the left singular vectors ; is an orthogonal matrix whose rows are the right singular vectors . Thus
To compute and/or , the arrays u and/or vt must be initialized to the unit matrix before nag_dbdsqr (f08mec) is called.
The function may also be used to compute the SVD of a real general matrix which has been reduced to bidiagonal form by an orthogonal transformation: . If is by with , then is by and is by ; if is by with , then is by and is by . In this case, the matrices and/or must be formed explicitly by f08kfc (nag_dorgbr) and passed to nag_dbdsqr (f08mec) in the arrays u and/or vt respectively.
nag_dbdsqr (f08mec) also has the capability of forming , where is an arbitrary real matrix; this is needed when using the SVD to solve linear least-squares problems.
nag_dbdsqr (f08mec) uses two different algorithms. If any singular vectors are required (i.e., if or or ), the bidiagonal algorithm is used, switching between zero-shift and implicitly shifted forms to preserve the accuracy of small singular values, and switching between and variants in order to handle graded matrices effectively (see Demmel and Kahan (1990)). If only singular values are required (that is, if ), they are computed by the differential qd algorithm (see Fernando and Parlett (1994)), which is faster and can achieve even greater accuracy.
The singular vectors are normalized so that , but are determined only to within a factor .
|
|
Error Indicators and Warnings
|
|
"NE_ALLOC_FAIL"
Dynamic memory allocation failed.
"NE_BAD_PARAM"
On entry, argument had an illegal value.
"NE_CONVERGENCE"
off-diagonals did not converge. The arrays d and e contain the diagonal and off-diagonal elements, respectively, of a bidiagonal matrix orthogonally equivalent to .
"NE_INT"
On entry, . Constraint: .
On entry, . Constraint: .
On entry, . Constraint: .
On entry, . Constraint: .
"NE_INTERNAL_ERROR"
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please consult NAG for assistance.
|
|
Further Comments
|
|
The total number of floating-point operations is roughly proportional to if only the singular values are computed. About additional operations are required to compute the left singular vectors and about to compute the right singular vectors. The operations to compute the singular values must all be performed in scalar mode; the additional operations to compute the singular vectors can be vectorized and on some machines may be performed much faster.
The complex analogue of this function is f08msc (nag_zbdsqr).
|
|
|
Examples
|
|
>
|
uplo := "Nag_Upper":
n := 4:
ncvt := 4:
nru := 4:
ncc := 0:
d := Vector([3.62, -2.41, 1.92, -1.43], datatype=float[8]):
e := Vector([1.26, -1.53, 1.19], datatype=float[8]):
vt := Matrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]], datatype=float[8]):
u := Matrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]], datatype=float[8]):
c := Matrix([[0]], datatype=float[8]):
NAG:-f08mec(uplo, ncvt, d, e, vt, u, c, 'n' = n, 'nru' = nru, 'ncc' = ncc):
|
|
|
See Also
|
|
Demmel J W and Kahan W (1990) Accurate singular values of bidiagonal matrices SIAM J. Sci. Statist. Comput. 11 873–912
Fernando K V and Parlett B N (1994) Accurate singular values and differential qd algorithms Numer. Math. 67 191–229
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
f08 Chapter Introduction.
NAG Toolbox Overview.
NAG Web Site.
|
|