# ?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.

## Syntax

call slasd7( icompq, nl, nr, sqre, k, d, z, zw, vf, vfw, vl, vlw, alpha, beta, dsigma, idx, idxp, idxq, perm, givptr, givcol, ldgcol, givnum, ldgnum, c, s, info )

call dlasd7( icompq, nl, nr, sqre, k, d, z, zw, vf, vfw, vl, vlw, alpha, beta, dsigma, idx, idxp, idxq, perm, givptr, givcol, ldgcol, givnum, ldgnum, c, s, info )

## Description

The routine ?lasd7 merges the two sets of singular values together into a single sorted set. Then it tries to deflate the size of the problem. There are two ways in which deflation can occur: when two or more singular values are close together or if there is a tiny entry in the Z vector. For each such occurrence the order of the related secular equation problem is reduced by one. ?lasd7 is called from ?lasd6.

## 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.

nl

  INTEGER. The row dimension of the upper block.

  `nl ≥ 1`.

nr

  INTEGER. The row dimension of the lower block.

  `nr ≥ 1`.

sqre

  INTEGER.

  = 0: the lower block is an nr-by-nr square matrix.

  = 1: the lower block is an nr-by-(nr+1) rectangular matrix. The bidiagonal matrix has `n = nl + nr + 1` rows and `m = n + sqre ≥ n` columns.

d

  REAL for slasd7

  DOUBLE PRECISION for dlasd7

  Array, DIMENSION (n). On entry d contains the singular values of the two submatrices to be combined.

zw

  REAL for slasd7

  DOUBLE PRECISION for dlasd7

  Array, DIMENSION ( m ).

  Workspace for z.

vf

  REAL for slasd7

  DOUBLE PRECISION for dlasd7

  Array, DIMENSION ( m ). On entry, `vf(1:nl+1)` contains the first components of all right singular vectors of the upper block; and `vf(nl+2:m)` contains the first components of all right singular vectors of the lower block.

vfw

  REAL for slasd7

  DOUBLE PRECISION for dlasd7

  Array, DIMENSION ( m ).

  Workspace for vf.

vl

  REAL for slasd7

  DOUBLE PRECISION for dlasd7

  Array, DIMENSION ( m ).

  On entry, `vl(1:nl+1)` contains the last components of all right singular vectors of the upper block; and `vl(nl+2:m)` contains the last components of all right singular vectors of the lower block.

VLW

  REAL for slasd7

  DOUBLE PRECISION for dlasd7

  Array, DIMENSION ( m ).

  Workspace for VL.

alpha

  REAL for slasd7

  DOUBLE PRECISION for dlasd7.

  Contains the diagonal element associated with the added row.

beta

  REAL for slasd7

  DOUBLE PRECISION for dlasd7

  Contains the off-diagonal element associated with the added row.

idx

  INTEGER.

  Workspace array, DIMENSION (n). This will contain the permutation used to sort the contents of d into ascending order.

idxp

  INTEGER.

  Workspace array, DIMENSION (n). This will contain the permutation used to place deflated values of d at the end of the array.

idxq

  INTEGER.

  Array, DIMENSION (n).

  This contains the permutation which separately sorts the two sub-problems in d into ascending order. Note that entries in the first half of this permutation must first be moved one position backward; and entries in the second half must first have `nl+1` added to their values.

ldgcol

  INTEGER.The leading dimension of the output array givcol, must be at least n.

ldgnum

  INTEGER. The leading dimension of the output array givnum, must be at least n.

## Output Parameters

k

  INTEGER. Contains the dimension of the non-deflated matrix, this is the order of the related secular equation.

  `1 ≤ k ≤ n`.

d

  On exit, d contains the trailing (n-k) updated singular values (those which were deflated) sorted into increasing order.

z

  REAL for slasd7

  DOUBLE PRECISION for dlasd7.

  Array, DIMENSION (m).

  On exit, Z contains the updating row vector in the secular equation.

vf

  On exit, vf contains the first components of all right singular vectors of the bidiagonal matrix.

vl

  On exit, vl contains the last components of all right singular vectors of the bidiagonal matrix.

dsigma

  REAL for slasd7

  DOUBLE PRECISION for dlasd7.

  Array, DIMENSION (n). Contains a copy of the diagonal elements (k-1 singular values and one zero) in the secular equation.

idxp

  On output, idxp(2: k) points to the nondeflated d-values and idxp( k+1:n) points to the deflated singular values.

perm

  INTEGER.

  Array, DIMENSION (n).

  The permutations (from deflation and sorting) to be applied to each singular block. Not referenced if `icompq = 0`.

givptr

  INTEGER.

  The number of Givens rotations which took place in this subproblem. Not referenced if `icompq = 0`.

givcol

  INTEGER.

  Array, DIMENSION ( ldgcol, 2 ). Each pair of numbers indicates a pair of columns to take place in a Givens rotation. Not referenced if `icompq = 0`.

givnum

  REAL for slasd7

  DOUBLE PRECISION for dlasd7.

  Array, DIMENSION ( ldgnum, 2 ). Each number indicates the C or S value to be used in the corresponding Givens rotation. Not referenced if `icompq = 0`.

c

  REAL for slasd7.

  DOUBLE PRECISION for dlasd7.

  If `sqre =0`, then c contains garbage, and if `sqre = 1`, then c contains C-value of a Givens rotation related to the right null space.

S

  REAL for slasd7.

  DOUBLE PRECISION for dlasd7.

  If `sqre =0`, then s contains garbage, and if `sqre = 1`, then s contains S-value of a Givens rotation related to the right null space.

info

  INTEGER.

  = 0: successful exit.

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

Parent topic: Auxiliary Routines