NAG CL Interface
f08mbc (dbdsvdx)
1
Purpose
f08mbc computes all or selected singular values and, optionally, the corresponding left and right singular vectors of a real by (upper or lower) bidiagonal matrix .
2
Specification
void |
f08mbc (Nag_OrderType order,
Nag_UploType uplo,
Nag_ComputeSingularVecsType jobz,
Nag_RangeType range,
Integer n,
const double d[],
const double e[],
double vl,
double vu,
Integer il,
Integer iu,
Integer *ns,
double s[],
double z[],
Integer pdz,
Integer jfail[],
NagError *fail) |
|
The function may be called by the names: f08mbc, nag_lapackeig_dbdsvdx or nag_dbdsvdx.
3
Description
f08mbc computes the singular value decomposition (SVD) of a real
by
(upper or lower) bidiagonal matrix
as
where
is a diagonal matrix with non-negative diagonal elements (the singular values of
), and
and
are orthogonal matrices. The columns of
and
are the left and right singular vectors of
, respectively.
Given an upper bidiagonal matrix
with diagonal
and superdiagonal
,
f08mbc computes the singular value decomposition of
through the eigenvalues and eigenvectors of the
by
tridiagonal matrix
If is a singular triplet of with , then and , , are eigenpairs of , with , and .
Given a
matrix, you can either
-
(i)compute and change signs so that the singular values (and corresponding vectors) are already in descending order (as in f08kbc) or
-
(ii)compute and reorder the values (and corresponding vectors).
f08mbc implements
(i) by calling
f08jbc (bisection plus inverse iteration, to be replaced with a version of the Multiple Relative Robust Representation algorithm. (See
Williams and Lang (2013).)
Alternative to computing all singular values of , a selected set can be computed. The set is either those singular values lying in a given interval, , or those whose index (counting from largest to smallest in magnitude) lies in a given range . In these cases, the corresponding left and right singular vectors can optionally be computed.
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
https://www.netlib.org/lapack/lug
Williams P and Lang B (2013) A framework for the Algorithm: theory and implementation SIAM J. Sci. Comput. 35 740–766
5
Arguments
-
1:
– Nag_OrderType
Input
-
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.1.3 in the Introduction to the NAG Library CL Interface for a more detailed explanation of the use of this argument.
Constraint:
or .
-
2:
– Nag_UploType
Input
-
On entry: indicates whether
is upper or lower bidiagonal.
- is upper bidiagonal.
- is lower bidiagonal.
Constraint:
or .
-
3:
– Nag_ComputeSingularVecsType
Input
-
On entry: indicates whether singular vectors are computed.
- Only singular values are computed.
- Singular values and singular vectors are computed.
Constraint:
or .
-
4:
– Nag_RangeType
Input
-
On entry: indicates which singular values should be returned.
- All singular values will be found.
- All singular values in the half-open interval will be found.
- The ilth through iuth singular values will be found.
Constraint:
, or .
-
5:
– Integer
Input
-
On entry: , the order of the bidiagonal matrix .
Constraint:
.
-
6:
– const double
Input
-
On entry: the diagonal elements of the bidiagonal matrix .
-
7:
– const double
Input
-
On entry: the off-diagonal elements of the bidiagonal matrix .
-
8:
– double
Input
-
On entry: if
, the lower bound of the interval to be searched for singular values.
If
or
,
vl is not referenced.
Constraint:
if , .
-
9:
– double
Input
-
On entry: if
, the upper bound of the interval to be searched for singular values.
If
or
,
vu is not referenced.
Constraint:
if , .
-
10:
– Integer
Input
-
11:
– Integer
Input
-
On entry: if
,
il and
iu specify the indices (in ascending order) of the smallest and largest singular values to be returned, respectively.
If
or
,
il and
iu are not referenced.
Constraints:
- if and , and ;
- if and , .
-
12:
– Integer *
Output
-
On exit: the total number of singular values found.
.
If , .
If , .
-
13:
– double
Output
-
On exit: the first
ns elements contain the selected singular values in ascending order.
-
14:
– double
Output
-
Note: the dimension,
dim, of the array
z
must be at least
- when
and
;
- when
and
;
- otherwise.
The
th element of the matrix
is stored in
- when ;
- when .
On exit: if
, then if
the first
ns columns of
z contain the singular vectors of the matrix
corresponding to the selected singular values, with
in rows
to
and
in rows
to
, i.e.,
If
, then
z is not referenced.
Note: the user must ensure that at least
columns are supplied in the array
. If
, the exact value of
ns is not known in advance and an upper bound of at least
n must be used.
-
15:
– Integer
Input
-
On entry: the stride separating row or column elements (depending on the value of
order) in the array
z.
Constraints:
- if ,
- if , ;
- otherwise ;
- if ,
- if ,
;
- otherwise .
-
16:
– Integer
Output
-
On exit: if
, then
- if NE_NOERROR, the first ns elements of jfail are zero;
- if NE_CONVERGENCE, jfail contains the indices of the eigenvectors that failed to converge in f08jbc.
If
,
jfail is not referenced.
-
17:
– NagError *
Input/Output
-
The NAG error argument (see
Section 7 in the Introduction to the NAG Library CL Interface).
6
Error Indicators and Warnings
- NE_ALLOC_FAIL
-
Dynamic memory allocation failed.
See
Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
- NE_BAD_PARAM
-
On entry, argument had an illegal value.
- NE_CONVERGENCE
-
The algorithm failed to converge;
eigenvectors of the associated eigenproblem did not converge. Their indices are stored in array
jfail.
- NE_ENUM_INT
-
On entry, and .
Constraint: .
- NE_ENUM_INT_2
-
On entry, , and .
Constraint: if , ;
otherwise .
On entry, , and .
Constraint: if ,
;
otherwise .
- NE_ENUM_INT_3
-
On entry, , , and .
Constraint: if and , and ;
if and , .
- NE_ENUM_REAL_1
-
On entry, and .
Constraint: if , .
- NE_ENUM_REAL_2
-
On entry, , and .
Constraint: if , .
- NE_INT
-
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 7.5 in the Introduction to the NAG Library CL Interface for further information.
- NE_NO_LICENCE
-
Your licence key may have expired or may not have been installed correctly.
See
Section 8 in the Introduction to the NAG Library CL Interface for further information.
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 vectors, see Section 4.9.1 of
Anderson et al. (1999). See also
f08flc.
8
Parallelism and Performance
f08mbc is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
f08mbc 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
f08mec, but for large matrices
f08mbc is usually much faster.
There is no complex analogue of f08mbc.
10
Example
This example computes the singular value decomposition of the upper bidiagonal matrix
10.1
Program Text
10.2
Program Data
10.3
Program Results