# naginterfaces.library.lapackeig.dbdsqr¶

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

dbdsqr computes the singular value decomposition of a real upper or lower bidiagonal matrix, or of a real general matrix which has been reduced to bidiagonal form.

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

https://support.nag.com/numeric/nl/nagdoc_30.1/flhtml/f08/f08mef.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 .

vtfloat, 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 orthogonal matrix returned by dorgbr() with .

ufloat, 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 orthogonal matrix returned by dorgbr() with .

cfloat, 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.

vtfloat, ndarray, shape

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

If , is not referenced.

ufloat, ndarray, shape

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

If , is not referenced.

cfloat, 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

dbdsqr 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 dbdsqr is called.

The function may also be used to compute the SVD of a real general matrix which has been reduced to bidiagonal form by an orthogonal 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 dorgbr() and passed to dbdsqr in the arrays and/or respectively.

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

dbdsqr 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 factor .

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