NAG Library Function Document
nag_dbdsdc (f08mdc)
1
Purpose
nag_dbdsdc (f08mdc) computes the singular values and, optionally, the left and right singular vectors of a real by (upper or lower) bidiagonal matrix .
2
Specification
#include <nag.h> |
#include <nagf08.h> |
void |
nag_dbdsdc (Nag_OrderType order,
Nag_UploType uplo,
Nag_ComputeSingularVecsType compq,
Integer n,
double d[],
double e[],
double u[],
Integer pdu,
double vt[],
Integer pdvt,
double q[],
Integer iq[],
NagError *fail) |
|
3
Description
nag_dbdsdc (f08mdc) computes the singular value decomposition (SVD) of the (upper or lower) bidiagonal matrix
as
where
is a diagonal matrix with non-negative diagonal elements
, such that
and
and
are orthogonal matrices. The diagonal elements of
are the singular values of
and the columns of
and
are respectively the corresponding left and right singular vectors of
.
When only singular values are required the function uses the algorithm, but when singular vectors are required a divide and conquer method is used. The singular values can optionally be returned in compact form, although currently no function is available to apply or when stored in compact form.
4
References
Anderson E, Bai Z, Bischof C, Blackford S, Demmel J, Dongarra J J, Du Croz J J, Greenbaum A, Hammarling S, McKenney A and Sorensen D (1999)
LAPACK Users' Guide (3rd Edition) SIAM, Philadelphia
http://www.netlib.org/lapack/lug
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
5
Arguments
- 1:
– Nag_OrderTypeInput
-
On entry: the
order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by
. See
Section 3.3.1.3 in How to Use the NAG Library and its Documentation for a more detailed explanation of the use of this argument.
Constraint:
or .
- 2:
– Nag_UploTypeInput
-
On entry: indicates whether
is upper or lower bidiagonal.
- is upper bidiagonal.
- is lower bidiagonal.
Constraint:
or .
- 3:
– Nag_ComputeSingularVecsTypeInput
-
On entry: specifies whether singular vectors are to be computed.
- Compute singular values only.
- Compute singular values and compute singular vectors in compact form.
- Compute singular values and singular vectors.
Constraint:
, or .
- 4:
– IntegerInput
-
On entry: , the order of the matrix .
Constraint:
.
- 5:
– doubleInput/Output
-
Note: the dimension,
dim, of the array
d
must be at least
.
On entry: the diagonal elements of the bidiagonal matrix .
On exit: if NE_NOERROR, the singular values of .
- 6:
– doubleInput/Output
-
Note: the dimension,
dim, of the array
e
must be at least
.
On entry: the off-diagonal elements of the bidiagonal matrix .
On exit: the contents of
e are destroyed.
- 7:
– doubleOutput
-
Note: the dimension,
dim, of the array
u
must be at least
- when
;
- otherwise.
The
th element of the matrix
is stored in
- when ;
- when .
On exit: if
, then if
NE_NOERROR,
u contains the left singular vectors of the bidiagonal matrix
.
If
,
u is not referenced.
- 8:
– IntegerInput
-
On entry: the stride separating row or column elements (depending on the value of
order) in the array
u.
Constraints:
- if , ;
- otherwise .
- 9:
– doubleOutput
-
Note: the dimension,
dim, of the array
vt
must be at least
- when
;
- otherwise.
The
th element of the matrix is stored in
- when ;
- when .
On exit: if
, then if
NE_NOERROR, the rows of
vt contain the right singular vectors of the bidiagonal matrix
.
If
,
vt is not referenced.
- 10:
– IntegerInput
-
On entry: the stride separating row or column elements (depending on the value of
order) in the array
vt.
Constraints:
- if , ;
- otherwise .
- 11:
– doubleOutput
-
Note: the dimension,
dim, of the array
q
must be at least
.
On exit: if
, then if
NE_NOERROR,
q and
iq contain the left and right singular vectors in a compact form, requiring
space instead of
. In particular,
q contains all the real data in the first
elements of
q, where
is equal to the maximum size of the subproblems at the bottom of the computation tree (usually about
).
If
,
q is not referenced.
- 12:
– IntegerOutput
-
Note: the dimension,
dim, of the array
iq
must be at least
.
On exit: if
, then if
NE_NOERROR,
q and
iq contain the left and right singular vectors in a compact form, requiring
space instead of
. In particular,
iq contains all integer data in the first
elements of
iq, where
is equal to the maximum size of the subproblems at the bottom of the computation tree (usually about
).
If
,
iq is not referenced.
- 13:
– NagError *Input/Output
-
The NAG error argument (see
Section 3.7 in How to Use the NAG Library and its Documentation).
6
Error Indicators and Warnings
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
See
Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
- NE_BAD_PARAM
-
On entry, argument had an illegal value.
- NE_ENUM_INT_2
-
On entry, , and .
Constraint: if , ;
otherwise .
On entry, , and .
Constraint: if , ;
otherwise .
- NE_INT
-
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 contact
NAG for assistance.
See
Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
- NE_NO_LICENCE
-
Your licence key may have expired or may not have been installed correctly.
See
Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
- NE_SINGULAR
-
The algorithm failed to compute a singular value. The update process of divide-and-conquer failed.
7
Accuracy
Each computed singular value of
is accurate to nearly full relative precision, no matter how tiny the singular value. The
th computed singular value,
, satisfies the bound
where
is the
machine precision and
is a modest function of
.
For bounds on the computed singular values, see Section 4.9.1 of
Anderson et al. (1999). See also
nag_ddisna (f08flc).
8
Parallelism and Performance
nag_dbdsdc (f08mdc) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
nag_dbdsdc (f08mdc) makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the
x06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
If only singular values are required, the total number of floating-point operations is approximately proportional to
. When singular vectors are required the number of operations is bounded above by approximately the same number of operations as
nag_dbdsqr (f08mec), but for large matrices
nag_dbdsdc (f08mdc) is usually much faster.
There is no complex analogue of nag_dbdsdc (f08mdc).
10
Example
This example computes the singular value decomposition of the upper bidiagonal matrix
10.1
Program Text
Program Text (f08mdce.c)
10.2
Program Data
Program Data (f08mdce.d)
10.3
Program Results
Program Results (f08mdce.r)