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 n by n (upper or lower) bidiagonal matrix B.

2 Specification

#include <nag.h>
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 n by n (upper or lower) bidiagonal matrix B as
B = USVT ,  
where S is a diagonal matrix with non-negative diagonal elements (the singular values of B), and U and VT are orthogonal matrices. The columns of U and V are the left and right singular vectors of B, respectively.
Given an upper bidiagonal matrix B with diagonal d= d1 d2 dn and superdiagonal e= e1 e2 eN-1 , f08mbc computes the singular value decomposition of B through the eigenvalues and eigenvectors of the n×2 by n×2 tridiagonal matrix
TGK= 0 d1 d1 0 e1 e1 0 d2 d2 . . . . .  
If s,u,v is a singular triplet of B with u=v=1, then s,q1 and -s,q2, q1=q2=1, are eigenpairs of TGK, with q1= v1,u1,v2,u2,,vn,un / 2, and q2= -v1,u1,-v2,u2,,-vn,un / 2.
Given a TGK matrix, you can either
  1. (i)compute -s,-v and change signs so that the singular values (and corresponding vectors) are already in descending order (as in f08kbc) or
  2. (ii)compute s,v 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 B, a selected set can be computed. The set is either those singular values lying in a given interval, σvl,vu, or those whose index (counting from largest to smallest in magnitude) lies in a given range 1il,,iun. 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 MR3 Algorithm: theory and implementation SIAM J. Sci. Comput. 35 740–766

5 Arguments

1: order 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 order=Nag_RowMajor. 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: order=Nag_RowMajor or Nag_ColMajor.
2: uplo Nag_UploType Input
On entry: indicates whether B is upper or lower bidiagonal.
uplo=Nag_Upper
B is upper bidiagonal.
uplo=Nag_Lower
B is lower bidiagonal.
Constraint: uplo=Nag_Upper or Nag_Lower.
3: jobz Nag_ComputeSingularVecsType Input
On entry: indicates whether singular vectors are computed.
jobz=Nag_NotSingularVecs
Only singular values are computed.
jobz=Nag_SingularVecs
Singular values and singular vectors are computed.
Constraint: jobz=Nag_NotSingularVecs or Nag_SingularVecs.
4: range Nag_RangeType Input
On entry: indicates which singular values should be returned.
range=Nag_AllValues
All singular values will be found.
range=Nag_Interval
All singular values in the half-open interval vl,vu will be found.
range=Nag_Indices
The ilth through iuth singular values will be found.
Constraint: range=Nag_AllValues, Nag_Interval or Nag_Indices.
5: n Integer Input
On entry: n, the order of the bidiagonal matrix B.
Constraint: n0.
6: d[n] const double Input
On entry: the diagonal elements d of the bidiagonal matrix B.
7: e[n-1] const double Input
On entry: the n-1 off-diagonal elements e of the bidiagonal matrix B.
8: vl double Input
On entry: if range=Nag_Interval, the lower bound of the interval to be searched for singular values.
If range=Nag_AllValues or Nag_Indices, vl is not referenced.
Constraint: if range=Nag_Interval, 0.0vl.
9: vu double Input
On entry: if range=Nag_Interval, the upper bound of the interval to be searched for singular values.
If range=Nag_AllValues or Nag_Indices, vu is not referenced.
Constraint: if range=Nag_Interval, vl<vu.
10: il Integer Input
11: iu Integer Input
On entry: if range=Nag_Indices, il and iu specify the indices (in ascending order) of the smallest and largest singular values to be returned, respectively.
If range=Nag_AllValues or Nag_Interval, il and iu are not referenced.
Constraints:
  • if range=Nag_Indices and n=0, il=1 and iu=0;
  • if range=Nag_Indices and n>0, 1 il iu n .
12: ns Integer * Output
On exit: the total number of singular values found. 0nsn.
If range=Nag_AllValues, ns=n.
If range=Nag_Indices, ns=iu-il+1.
13: s[n] double Output
On exit: the first ns elements contain the selected singular values in ascending order.
14: z[dim] double Output
Note: the dimension, dim, of the array z must be at least
  • pdz×(minn,ns+1) when jobz=Nag_SingularVecs and order=Nag_ColMajor;
  • max1,max2,n×2×pdz when jobz=Nag_SingularVecs and order=Nag_RowMajor;
  • 1 otherwise.
The i,jth element of the matrix Z is stored in
  • z[j-1×pdz+i-1] when order=Nag_ColMajor;
  • z[i-1×pdz+j-1] when order=Nag_RowMajor.
On exit: if jobz=Nag_SingularVecs, then if fail.errnum=0 the first ns columns of z contain the singular vectors of the matrix B corresponding to the selected singular values, with U in rows 1 to n and V in rows n+1 to n×2, i.e.,
Z= U V .  
If jobz=Nag_NotSingularVecs, then z is not referenced.
Note: the user must ensure that at least K=minn,ns+1 columns are supplied in the array Z. If range=Nag_Interval, the exact value of ns is not known in advance and an upper bound of at least n must be used.
15: pdz Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array z.
Constraints:
  • if order=Nag_ColMajor,
    • if jobz=Nag_SingularVecs, pdz max2,n×2 ;
    • otherwise pdz1;
  • if order=Nag_RowMajor,
    • if jobz=Nag_SingularVecs, pdzminn,ns+1;
    • otherwise pdz1.
16: jfail[2×n] Integer Output
On exit: if jobz=Nag_SingularVecs, then
  • if fail.code= NE_NOERROR, the first ns elements of jfail are zero;
  • if fail.code= NE_CONVERGENCE, jfail contains the indices of the eigenvectors that failed to converge in f08jbc.
If jobz=Nag_NotSingularVecs, jfail is not referenced.
17: fail 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 value had an illegal value.
NE_CONVERGENCE
The algorithm failed to converge; value eigenvectors of the associated eigenproblem did not converge. Their indices are stored in array jfail.
NE_ENUM_INT
On entry, jobz=value and n=value.
Constraint: minn,ns+1>0.
NE_ENUM_INT_2
On entry, jobz=value, pdz=value and n=value.
Constraint: if jobz=Nag_SingularVecs, pdz max2,n×2 ;
otherwise pdz1.
On entry, jobz=value, pdz=value and n=value.
Constraint: if jobz=Nag_SingularVecs, pdzminn,ns+1;
otherwise pdz1.
NE_ENUM_INT_3
On entry, range=value, il=value, iu=value and n=value.
Constraint: if range=Nag_Indices and n=0, il=1 and iu=0;
if range=Nag_Indices and n>0, 1 il iu n .
NE_ENUM_REAL_1
On entry, range=value and vl=value.
Constraint: if range=Nag_Interval, 0.0vl.
NE_ENUM_REAL_2
On entry, range=value, vl=value and vu=value.
Constraint: if range=Nag_Interval, vl<vu.
NE_INT
On entry, n=value.
Constraint: n0.
On entry, pdz=value.
Constraint: pdz>0.
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 B is accurate to nearly full relative precision, no matter how tiny the singular value. The ith computed singular value, s^i, satisfies the bound
s^i-si pnεsi  
where ε is the machine precision and pn is a modest function of n.
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.

9 Further Comments

If only singular values are required, the total number of floating-point operations is approximately proportional to n2. 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
B = 3.62 1.26 0.00 0.00 0.00 -2.41 -1.53 0.00 0.00 0.00 1.92 1.19 0.00 0.00 0.00 -1.43 .  

10.1 Program Text

Program Text (f08mbce.c)

10.2 Program Data

Program Data (f08mbce.d)

10.3 Program Results

Program Results (f08mbce.r)