# ?bdsdc

Computes the singular value decomposition of a real bidiagonal matrix using a divide and conquer method.

## Syntax

FORTRAN 77:

call sbdsdc(uplo, compq, n, d, e, u, ldu, vt, ldvt, q, iq, work, iwork, info)

call dbdsdc(uplo, compq, n, d, e, u, ldu, vt, ldvt, q, iq, work, iwork, info)

Fortran 95:

call bdsdc(d, e [,u] [,vt] [,q] [,iq] [,uplo] [,info])

## Description

This routine computes the Singular Value Decomposition (SVD) of a real n-by-n (upper or lower) bidiagonal matrix B: `B = U*Σ*VT`, using a divide and conquer method, where Σ is a diagonal matrix with non-negative diagonal elements (the singular values of B), and U and V are orthogonal matrices of left and right singular vectors, respectively. ?bdsdc can be used to compute all singular values, and optionally, singular vectors or singular vectors in compact form.

This rotuine uses ?lasd0, ?lasd1, ?lasd2, ?lasd3, ?lasd4, ?lasd5, ?lasd6, ?lasd7, ?lasd8, ?lasd9, ?lasda, ?lasdq, ?lasdt.

## Input Parameters

uplo

  CHARACTER*1. Must be 'U' or 'L'.

  If `uplo = 'U'`, B is an upper bidiagonal matrix.

  If `uplo = 'L'`, B is a lower bidiagonal matrix.

compq

  CHARACTER*1. Must be 'N', 'P', or 'I'.

  If `compq = 'N'`, compute singular values only.

  If `compq = 'P'`, compute singular values and compute singular vectors in compact form.

  If `compq = 'I'`, compute singular values and singular vectors.

n

  INTEGER. The order of the matrix B (`n ≥ 0`).

d, e, work

  REAL for sbdsdc

  DOUBLE PRECISION for dbdsdc.

  Arrays:

  d(*) contains the n diagonal elements of the bidiagonal matrix B.

  The dimension of d must be at least max(1, n).

  e(*) contains the off-diagonal elements of the bidiagonal matrix B.

  The dimension of e must be at least max(1, n).

  work(*) is a workspace array.

  The dimension of work must be at least:

  max(1, 4*n), if `compq = 'N'`;

  max(1, 6*n), if `compq = 'P'`;

  max(1, 3*n2+4*n), if `compq = 'I'`.

ldu

  INTEGER. The first dimension of the output array u; ldu ≥ 1.

  If singular vectors are desired, then ldu ≥ max(1, n).

ldvt

  INTEGER. The first dimension of the output array vt; ldvt ≥ 1.

  If singular vectors are desired, then ldvt ≥ max(1, n).

iwork

  INTEGER. Workspace array, dimension at least max(1, 8*n).

## Output Parameters

d

  If `info = 0`, overwritten by the singular values of B.

e

  On exit, e is overwritten.

u, vt, q

  REAL for sbdsdc

  DOUBLE PRECISION for dbdsdc.

  Arrays: u(ldu,*), vt(ldvt,*), q(*).

  If `compq = 'I'`, then on exit u contains the left singular vectors of the bidiagonal matrix B, unless `info ≠ 0` (see info). For other values of compq, u is not referenced.

  The second dimension of u must be at least max(1,n).

  if `compq = 'I'`, then on exit vt contains the right singular vectors of the bidiagonal matrix B, unless `info ≠ 0` (see info). For other values of compq, vt is not referenced. The second dimension of vt must be at least max(1,n).

  If `compq = 'P'`, then on exit, if `info = 0`, q and iq contain the left and right singular vectors in a compact form. Specifically, q contains all the REAL (for sbdsdc) or DOUBLE PRECISION (for dbdsdc) data for singular vectors. For other values of compq, q is not referenced. See Application notes for details.

iq

  INTEGER.

  Array: iq(*).

  If `compq = 'P'`, then on exit, if `info = 0`, q and iq contain the left and right singular vectors in a compact form. Specifically, iq contains all the INTEGER data for singular vectors. For other values of compq, iq is not referenced. See Application notes for details.

info

  INTEGER.

  If `info = 0`, the execution is successful.

  If `info = -i`, the i-th parameter had an illegal value.

  If `info = i`, the algorithm failed to compute a singular value. The update process of divide and conquer failed.

## Fortran 95 Interface Notes

Routines in Fortran 95 interface have fewer arguments in the calling sequence than their FORTRAN 77 counterparts. For general conventions applied to skip redundant or restorable arguments, see Fortran 95 Interface Conventions.

Specific details for the routine bdsdc interface are the following:

d

  Holds the vector of length (n).

e

  Holds the vector of length (n).

u

  Holds the matrix U of size (n,n).

vt

  Holds the matrix VT of size (n,n).

q

  Holds the vector of length (ldq), where

  `ldq ≥ n*(11 + 2*smlsiz + 8*int(log_2(n/(smlsiz + 1))))` and smlsiz is returned by ilaenv and is equal to the maximum size of the subproblems at the bottom of the computation tree (usually about 25).

compq

  Restored based on the presence of arguments u, vt, q, and iq as follows:

  `compq = 'N'`, if none of u, vt, q, and iq are present,

  `compq = 'I'`, if both u and vt are present. Arguments u and vt must either be both present or both omitted,

  `compq = 'P'`, if both q and iq are present. Arguments q and iq must either be both present or both omitted.

  Note that there will be an error condition if all of u, vt, q, and iq arguments are present simultaneously.

## See Also

?lasd0 Computes the singular values of a real upper bidiagonal n-by-m matrix B with diagonal d and off-diagonal e. Used by ?bdsdc.
?lasd1 Computes the SVD of an upper bidiagonal matrix B of the specified size. Used by ?bdsdc.
?lasd2 Merges the two sets of singular values together into a single sorted set. Used by ?bdsdc.
?lasd3 Finds all square roots of the roots of the secular equation, as defined by the values in D and Z, and then updates the singular vectors by matrix multiplication. Used by ?bdsdc.
?lasd4 Computes the square root of the i-th updated eigenvalue of a positive symmetric rank-one modification to a positive diagonal matrix. Used by ?bdsdc.
?lasd5 Computes the square root of the i-th eigenvalue of a positive symmetric rank-one modification of a 2-by-2 diagonal matrix.Used by ?bdsdc.
?lasd6 Computes the SVD of an updated upper bidiagonal matrix obtained by merging two smaller ones by appending a row. Used by ?bdsdc.
?lasd7 Merges the two sets of singular values together into a single sorted set. Then it tries to deflate the size of the problem. Used by ?bdsdc.
?lasd8 Finds the square roots of the roots of the secular equation, and stores, for each element in D, the distance to its two nearest poles. Used by ?bdsdc.
?lasd9 Finds the square roots of the roots of the secular equation, and stores, for each element in D, the distance to its two nearest poles. Used by ?bdsdc.
?lasda Computes the singular value decomposition (SVD) of a real upper bidiagonal matrix with diagonal d and off-diagonal e. Used by ?bdsdc.
?lasdq Computes the SVD of a real bidiagonal matrix with diagonal d and off-diagonal e. Used by ?bdsdc.
?lasdt Creates a tree of subproblems for bidiagonal divide and conquer. Used by ?bdsdc.
Parent topic: Singular Value Decomposition