# ?lasda

Computes the singular value decomposition (SVD) of a real upper bidiagonal matrix with diagonal d and off-diagonal e. Used by ?bdsdc.

## Syntax

call slasda( icompq, smlsiz, n, sqre, d, e, u, ldu, vt, k, difl, difr, z, poles, givptr, givcol, ldgcol, perm, givnum, c, s, work, iwork, info )

call dlasda( icompq, smlsiz, n, sqre, d, e, u, ldu, vt, k, difl, difr, z, poles, givptr, givcol, ldgcol, perm, givnum, c, s, work, iwork, info )

## Description

Using a divide and conquer approach, ?lasda computes the singular value decomposition (SVD) of a real upper bidiagonal n-by-m matrix B with diagonal d and off-diagonal e, where `m = n + sqre`.

The algorithm computes the singular values in the SVD `B = U*S*VT`. The orthogonal matrices U and VT are optionally computed in compact form. A related subroutine ?lasd0 computes the singular values and the singular vectors in explicit form.

## Input Parameters

icompq

  INTEGER.

  Specifies whether singular vectors are to be computed in compact form, as follows:

  = 0: Compute singular values only.

  = 1: Compute singular vectors of upper bidiagonal matrix in compact form.

smlsiz

  INTEGER.

  The maximum size of the subproblems at the bottom of the computation tree.

n

  INTEGER. The row dimension of the upper bidiagonal matrix. This is also the dimension of the main diagonal array d.

sqre

  INTEGER. Specifies the column dimension of the bidiagonal matrix.

  If `sqre = 0`: the bidiagonal matrix has column dimension `m = n`

  If `sqre = 1`: the bidiagonal matrix has column dimension `m = n + 1`.

d

  REAL for slasda

  DOUBLE PRECISION for dlasda.

  Array, DIMENSION (n). On entry, d contains the main diagonal of the bidiagonal matrix.

e

  REAL for slasda

  DOUBLE PRECISION for dlasda.

  Array, DIMENSION ( m - 1 ). Contains the subdiagonal entries of the bidiagonal matrix. On exit, e is destroyed.

ldu

  INTEGER. The leading dimension of arrays u, vt, difl, difr, poles, givnum, and z. `ldu ≥ n`.

ldgcol

  INTEGER. The leading dimension of arrays givcol and perm. `ldgcol ≥ n`.

work

  REAL for slasda

  DOUBLE PRECISION for dlasda.

  Workspace array, DIMENSION`(6n+(smlsiz+1)2)`.

iwork

  INTEGER.

  Workspace array, Dimension must be at least (7n).

## Output Parameters

d

  On exit d, if `info = 0`, contains the singular values of the bidiagonal matrix.

u

  REAL for slasda

  DOUBLE PRECISION for dlasda.

  Array, DIMENSION (ldu, smlsiz) if `icompq =1`.

  Not referenced if `icompq = 0`.

  If `icompq = 1`, on exit, u contains the left singular vector matrices of all subproblems at the bottom level.

vt

  REAL for slasda

  DOUBLE PRECISION for dlasda.

  Array, DIMENSION ( ldu, smlsiz+1 ) if `icompq = 1`, and not referenced if `icompq = 0`. If `icompq = 1`, on exit, vt' contains the right singular vector matrices of all subproblems at the bottom level.

k

  INTEGER.

  Array, DIMENSION (n) if `icompq = 1` and

  DIMENSION (1) if `icompq = 0`.

  If `icompq = 1`, on exit, k(i) is the dimension of the i-th secular equation on the computation tree.

difl

  REAL for slasda

  DOUBLE PRECISION for dlasda.

  Array, DIMENSION ( ldu, nlvl ),

  where `nlvl = floor(log2(n/smlsiz))`.

difr

  REAL for slasda

  DOUBLE PRECISION for dlasda.

  Array,

  DIMENSION ( ldu, 2 nlvl ) if `icompq = 1` and

  DIMENSION (n) if `icompq = 0`.

  If `icompq = 1`, on exit, difl(1:n, i) and difr(1:n,2i -1) record distances between singular values on the i-th level and singular values on the (i -1)-th level, and difr(1:n, 2i ) contains the normalizing factors for the right singular vector matrix. See ?lasd8 for details.

z

  REAL for slasda

  DOUBLE PRECISION for dlasda.

  Array,

  DIMENSION ( ldu, nlvl ) if `icompq = 1` and

  DIMENSION (n) if `icompq = 0`. The first k elements of z(1, i) contain the components of the deflation-adjusted updating row vector for subproblems on the i-th level.

poles

  REAL for slasda

  DOUBLE PRECISION for dlasda

  Array, DIMENSION `(ldu, 2*nlvl)`

  if `icompq = 1`, and not referenced if `icompq = 0`. If `icompq = 1`, on exit, poles(1, 2i - 1) and poles(1, 2i) contain the new and old singular values involved in the secular equations on the i-th level.

givptr

  INTEGER. Array, DIMENSION (n) if `icompq = 1`, and not referenced if `icompq = 0`. If `icompq = 1`, on exit, givptr( i ) records the number of Givens rotations performed on the i-th problem on the computation tree.

givcol

  INTEGER .

  Array, DIMENSION `(ldgcol, 2*nlvl)` if `icompq = 1`, and not referenced if `icompq = 0`. If `icompq = 1`, on exit, for each i, givcol(1, 2 i - 1) and givcol(1, 2 i) record the locations of Givens rotations performed on the i-th level on the computation tree.

perm

  INTEGER . Array, DIMENSION ( ldgcol, nlvl ) if `icompq = 1`, and not referenced if `icompq = 0`. If `icompq = 1`, on exit, perm (1, i) records permutations done on the i-th level of the computation tree.

givnum

  REAL for slasda

  DOUBLE PRECISION for dlasda.

  Array DIMENSION ( ldu, 2*nlvl ) if `icompq = 1`, and not referenced if `icompq = 0`. If `icompq = 1`, on exit, for each i, givnum(1, 2 i - 1) and givnum(1, 2 i) record the C- and S-values of Givens rotations performed on the i-th level on the computation tree.

c

  REAL for slasda

  DOUBLE PRECISION for dlasda.

  Array,

  DIMENSION (n) if `icompq = 1`, and

  DIMENSION (1) if `icompq = 0`.

  If `icompq = 1` and the i-th subproblem is not square, on exit, c(i) contains the C-value of a Givens rotation related to the right null space of the i-th subproblem.

s

  REAL for slasda

  DOUBLE PRECISION for dlasda.

  Array,

  DIMENSION (n) `icompq = 1`, and

  DIMENSION (1) if `icompq = 0`.

  If `icompq = 1` and the i-th subproblem is not square, on exit, s(i) contains the S-value of a Givens rotation related to the right null space of the i-th subproblem.

info

  INTEGER.

  = 0: successful exit.

  < 0: if info = -i, the i-th argument had an illegal value

  > 0: If `info = 1`, an singular value did not converge

Parent topic: Auxiliary Routines