# naginterfaces.library.lapackeig.zbdsqr¶

naginterfaces.library.lapackeig.zbdsqr(uplo, d, e, vt, u, c)[source]

zbdsqr computes the singular value decomposition of a complex general matrix which has been reduced to bidiagonal form.

For full information please refer to the NAG Library document for f08ms

https://support.nag.com/numeric/nl/nagdoc_30.1/flhtml/f08/f08msf.html

Parameters
uplostr, length 1

Indicates whether is an upper or lower bidiagonal matrix.

is an upper bidiagonal matrix.

is a lower bidiagonal matrix.

dfloat, array-like, shape

The diagonal elements of the bidiagonal matrix .

efloat, array-like, shape

The off-diagonal elements of the bidiagonal matrix .

vtcomplex, array-like, shape

Note: the required extent for this argument in dimension 1 is determined as follows: if : ; otherwise: .

If , must contain an matrix. If the right singular vectors of are required, and must contain the unit matrix; if the right singular vectors of are required, must contain the unitary matrix returned by zungbr() with .

ucomplex, array-like, shape

If , must contain an matrix. If the left singular vectors of are required, and must contain the unit matrix; if the left singular vectors of are required, must contain the unitary matrix returned by zungbr() with .

ccomplex, array-like, shape

Note: the required extent for this argument in dimension 1 is determined as follows: if : ; otherwise: .

The matrix if .

Returns
dfloat, ndarray, shape

The singular values in decreasing order of magnitude, unless > 0 (in which case see Exceptions).

efloat, ndarray, shape

is overwritten, but if > 0 see Exceptions.

vtcomplex, ndarray, shape

The matrix or of right singular vectors, stored by rows.

If , is not referenced.

ucomplex, ndarray, shape

The matrix or of left singular vectors, stored as columns of the matrix.

If , is not referenced.

ccomplex, ndarray, shape

is overwritten by the matrix . If , is not referenced.

Raises
NagValueError
(errno )

On entry, error in parameter .

Constraint: or .

(errno )

On entry, error in parameter .

Constraint: .

(errno )

On entry, error in parameter .

Constraint: .

(errno )

On entry, error in parameter .

Constraint: .

(errno )

On entry, error in parameter .

Constraint: .

Warns
NagAlgorithmicWarning
(errno )

off-diagonals did not converge. The arrays and contain the diagonal and off-diagonal elements, respectively, of a bidiagonal matrix orthogonally equivalent to .

Notes

zbdsqr computes the singular values and, optionally, the left or right singular vectors of a real upper or lower bidiagonal matrix . In other words, it can compute the singular value decomposition (SVD) of as

Here is a diagonal matrix with real diagonal elements (the singular values of ), such that

is an orthogonal matrix whose columns are the left singular vectors ; is an orthogonal matrix whose rows are the right singular vectors . Thus

To compute and/or , the arrays and/or must be initialized to the unit matrix before zbdsqr is called.

The function stores the real orthogonal matrices and in complex arrays and , so that it may also be used to compute the SVD of a complex general matrix which has been reduced to bidiagonal form by a unitary transformation: . If is with , then is and is ; if is with , then is and is . In this case, the matrices and/or must be formed explicitly by zungbr() and passed to zbdsqr in the arrays and/or respectively.

zbdsqr also has the capability of forming , where is an arbitrary complex matrix; this is needed when using the SVD to solve linear least squares problems.

zbdsqr uses two different algorithms. If any singular vectors are required (i.e., if or or ), the bidiagonal algorithm is used, switching between zero-shift and implicitly shifted forms to preserve the accuracy of small singular values, and switching between and variants in order to handle graded matrices effectively (see Demmel and Kahan (1990)). If only singular values are required (i.e., if ), they are computed by the differential qd algorithm (see Fernando and Parlett (1994)), which is faster and can achieve even greater accuracy.

The singular vectors are normalized so that , but are determined only to within a complex factor of absolute value .

References

Demmel, J W and Kahan, W, 1990, Accurate singular values of bidiagonal matrices, SIAM J. Sci. Statist. Comput. (11), 873–912

Fernando, K V and Parlett, B N, 1994, Accurate singular values and differential qd algorithms, Numer. Math. (67), 191–229

Golub, G H and Van Loan, C F, 1996, Matrix Computations, (3rd Edition), Johns Hopkins University Press, Baltimore