# ?lalsd

Uses the singular value decomposition of A to solve the least squares problem.

## Syntax

call slalsd( uplo, smlsiz, n, nrhs, d, e, b, ldb, rcond, rank, work, iwork, info )

call dlalsd( uplo, smlsiz, n, nrhs, d, e, b, ldb, rcond, rank, work, iwork, info )

call clalsd( uplo, smlsiz, n, nrhs, d, e, b, ldb, rcond, rank, work, rwork, iwork, info )

call zlalsd( uplo, smlsiz, n, nrhs, d, e, b, ldb, rcond, rank, work, rwork, iwork, info )

## Include Files

• Fortran: mkl.fi
• C: mkl.h

## Description

The routine uses the singular value decomposition of A to solve the least squares problem of finding X to minimize the Euclidean norm of each column of A*X-B, where A is n-by-n upper bidiagonal, and X and B are n-by-nrhs. The solution X overwrites B.

The singular values of A smaller than rcond times the largest singular value are treated as zero in solving the least squares problem; in this case a minimum norm solution is returned. The actual singular values are returned in d in ascending order.

This code makes very mild assumptions about floating point arithmetic. It will work on machines with a guard digit in add/subtract, or on those binary machines without guard digits which subtract like the Cray XMP, Cray YMP, Cray C 90, or Cray 2.

It could conceivably fail on hexadecimal or decimal machines without guard digits, but we know of none.

## Input Parameters

uplo

CHARACTER*1.

If uplo = 'U', d and e define an upper bidiagonal matrix.

If uplo = 'L', d and e define a lower bidiagonal matrix.

smlsiz

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

n

INTEGER. The dimension of the bidiagonal matrix.

n 0.

nrhs

INTEGER. The number of columns of B. Must be at least 1.

d

REAL for slalsd/clalsd

DOUBLE PRECISION for dlalsd/zlalsd

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

e

REAL for slalsd/clalsd

DOUBLE PRECISION for dlalsd/zlalsd

Array, DIMENSION (n-1). Contains the super-diagonal entries of the bidiagonal matrix. On exit, e is destroyed.

b

REAL for slalsd

DOUBLE PRECISION for dlalsd

COMPLEX for clalsd

DOUBLE COMPLEX for zlalsd

Array, DIMENSION (ldb,nrhs).

On input, b contains the right hand sides of the least squares problem. On output, b contains the solution X.

ldb

INTEGER. The leading dimension of b in the calling subprogram. Must be at least max(1,n).

rcond

REAL for slalsd/clalsd

DOUBLE PRECISION for dlalsd/zlalsd

The singular values of A less than or equal to rcond times the largest singular value are treated as zero in solving the least squares problem. If rcond is negative, machine precision is used instead. For example, for the least squares problem diag(S)*X=B, where diag(S) is a diagonal matrix of singular values, the solution is X(i)=B(i)/S(i) if S(i) is greater than rcond *max(S), and X(i)=0 if S(i) is less than or equal to rcond *max(S).

rank

INTEGER. The number of singular values of A greater than rcond times the largest singular value.

work

REAL for slalsd

DOUBLE PRECISION for dlalsd

COMPLEX for clalsd

DOUBLE COMPLEX for zlalsd

Workspace array.

DIMENSION for real flavors at least

(9n+2n*smlsiz+8n*nlvl+n*nrhs+(smlsiz+1)2),

where

nlvl = max(0, int(log2(n/(smlsiz+1))) + 1).

DIMENSION for complex flavors is (n*nrhs).

rwork

REAL for clalsd

DOUBLE PRECISION for zlalsd

Workspace array, used with complex flavors only.

DIMENSION at least (9n + 2n*smlsiz + 8n*nlvl + 3*mlsiz*nrhs + (smlsiz+1)2),

where

nlvl = max(0, int(log2(min(m,n)/(smlsiz+1))) + 1).

iwork

INTEGER.

Workspace array of DIMENSION (3n*nlvl + 11n).

## Output Parameters

d

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

e

On exit, destroyed.

b

On exit, b contains the solution X.

info

INTEGER.

If info = 0: successful exit.

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

If info > 0: The algorithm failed to compute a singular value while working on the submatrix lying in rows and columns info/(n+1) through mod(info,n+1).

For more complete information about compiler optimizations, see our Optimization Notice.