# ?lals0

Applies back multiplying factors in solving the least squares problem using divide and conquer SVD approach. Used by ?gelsd.

## Syntax

call slals0 ( icompq, nl, nr, sqre, nrhs, b, ldb, bx, ldbx, perm, givptr, givcol, ldgcol, givnum, ldgnum, poles, difl, difr, z, k, c, s, work, info )

call dlals0 ( icompq, nl, nr, sqre, nrhs, b, ldb, bx, ldbx, perm, givptr, givcol, ldgcol, givnum, ldgnum, poles, difl, difr, z, k, c, s, work, info )

call clals0( icompq, nl, nr, sqre, nrhs, b, ldb, bx, ldbx, perm, givptr, givcol, ldgcol, givnum, ldgnum, poles, difl, difr, z, k, c, s, rwork, info )

call zlals0( icompq, nl, nr, sqre, nrhs, b, ldb, bx, ldbx, perm, givptr, givcol, ldgcol, givnum, ldgnum, poles, difl, difr, z, k, c, s, rwork, info )

## Description

The routine applies back the multiplying factors of either the left or right singular vector matrix of a diagonal matrix appended by a row to the right hand side matrix B in solving the least squares problem using the divide-and-conquer SVD approach.

For the left singular vector matrix, three types of orthogonal matrices are involved:

(1L) Givens rotations: the number of such rotations is givptr;the pairs of columns/rows they were applied to are stored in givcol;and the c- and s-values of these rotations are stored in givnum.

(2L) Permutation. The (nl+1)-st row of B is to be moved to the first row, and for j=2:n, perm(j)-th row of B is to be moved to the j-th row.

(3L) The left singular vector matrix of the remaining matrix.

For the right singular vector matrix, four types of orthogonal matrices are involved:

(1R) The right singular vector matrix of the remaining matrix.

(2R) If `sqre = 1`, one extra Givens rotation to generate the right null space.

(3R) The inverse transformation of (2L).

(4R) The inverse transformation of (1L).

## Input Parameters

icompq

  INTEGER. Specifies whether singular vectors are to be computed in factored form:

  If `icompq = 0`: Left singular vector matrix.

  If `icompq = 1`: Right singular vector matrix.

nl

  INTEGER. The row dimension of the upper block.

  `nl ≥ 1`.

nr

  INTEGER. The row dimension of the lower block.

  `nr ≥ 1`.

sqre

  INTEGER.

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

  If `sqre = 1`: the lower block is an nr-by-(nr+1) rectangular matrix. The bidiagonal matrix has row dimension `n = nl + nr + 1`, and column dimension `m = n + sqre`.

nrhs

  INTEGER. The number of columns of B and bx.

  Must be at least 1.

b

  REAL for slals0

  DOUBLE PRECISION for dlals0

  COMPLEX for clals0

  COMPLEX*16 for zlals0.

  Array, DIMENSION ( ldb, nrhs ).

  Contains the right hand sides of the least squares problem in rows 1 through m.

ldb

  INTEGER. The leading dimension of b.

  Must be at least `max(1,max( m, n ))`.

bx

  REAL for slals0

  DOUBLE PRECISION for dlals0

  COMPLEX for clals0

  COMPLEX*16 for zlals0.

  Workspace array, DIMENSION ( ldbx, nrhs ).

ldbx

  INTEGER. The leading dimension of bx.

perm

  INTEGER. Array, DIMENSION (n).

  The permutations (from deflation and sorting) applied to the two blocks.

givptr

  INTEGER. The number of Givens rotations which took place in this subproblem.

givcol

  INTEGER. Array, DIMENSION ( ldgcol, 2 ). Each pair of numbers indicates a pair of rows/columns involved in a Givens rotation.

ldgcol

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

givnum

  REAL for slals0/clals0

  DOUBLE PRECISION for dlals0/zlals0

  Array, DIMENSION ( ldgnum, 2 ). Each number indicates the c or s value used in the corresponding Givens rotation.

ldgnum

  INTEGER. The leading dimension of arrays difr, poles and givnum, must be at least k.

poles

  REAL for slals0/clals0

  DOUBLE PRECISION for dlals0/zlals0

  Array, DIMENSION ( ldgnum, 2 ). On entry, poles(1:k, 1) contains the new singular values obtained from solving the secular equation, and poles(1:k, 2) is an array containing the poles in the secular equation.

difl

  REAL for slals0/clals0

  DOUBLE PRECISION for dlals0/zlals0

  Array, DIMENSION ( k ). On entry, difl(i) is the distance between i-th updated (undeflated) singular value and the i-th (undeflated) old singular value.

difr

  REAL for slals0/clals0

  DOUBLE PRECISION for dlals0/zlals0

  Array, DIMENSION ( ldgnum, 2 ). On entry, difr(i, 1) contains the distances between i-th updated (undeflated) singular value and the i+1-th (undeflated) old singular value. And difr(i, 2) is the normalizing factor for the i-th right singular vector.

z

  REAL for slals0/clals0

  DOUBLE PRECISION for dlals0/zlals0

  Array, DIMENSION ( k ). Contains the components of the deflation-adjusted updating row vector.

K

  INTEGER. Contains the dimension of the non-deflated matrix. This is the order of the related secular equation. `1 ≤ k ≤ n`.

c

  REAL for slals0/clals0

  DOUBLE PRECISION for dlals0/zlals0

  Contains garbage if `sqre =0` and the c value of a Givens rotation related to the right null space if `sqre = 1`.

s

  REAL for slals0/clals0

  DOUBLE PRECISION for dlals0/zlals0

  Contains garbage if `sqre =0` and the s value of a Givens rotation related to the right null space if `sqre = 1`.

work

  REAL for slals0

  DOUBLE PRECISION for dlals0

  Workspace array, DIMENSION ( k ). Used with real flavors only.

rwork

  REAL for clals0

  DOUBLE PRECISION for zlals0

  Workspace array, DIMENSION (k*(1+nrhs) + 2*nrhs). Used with complex flavors only.

## Output Parameters

b

  On exit, contains the solution X in rows 1 through n.

info

  INTEGER.

  If `info = 0`: successful exit.

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

Parent topic: Auxiliary Routines