naginterfaces.library.eigen.real_​triang_​svd

naginterfaces.library.eigen.real_triang_svd(n, a, b, wantq, wantp)[source]

real_triang_svd returns all, or part, of the singular value decomposition of a real upper triangular matrix.

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

https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/f02/f02wuf.html

Parameters
nint

, the order of the matrix .

If , an immediate return is effected.

afloat, array-like, shape

The leading upper triangular part of the array must contain the upper triangular matrix .

bfloat, array-like, shape

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

With , the leading part of the array must contain the matrix to be transformed.

wantqbool

Must be if the matrix is required.

If , the array is not referenced.

wantpbool

Must be if the matrix is required, in which case is overwritten on the array , otherwise must be .

Returns
afloat, ndarray, shape

If , the part of will contain the orthogonal matrix , otherwise the upper triangular part of is used as internal workspace, but the strictly lower triangular part of is not referenced.

bfloat, ndarray, shape

The leading part of the array is overwritten by the matrix .

qfloat, ndarray, shape

With , the leading part of the array will contain the orthogonal matrix . Otherwise the array is not referenced.

svfloat, ndarray, shape

If no exception or warning is raised the array will contain the diagonal elements of the matrix.

If = 1 the array will contain the diagonal elements of the bidiagonal matrix in the factorization ; the superdiagonal elements of will be contained in the first elements of .

workfloat, ndarray, shape

contains the super-diagonal elements of the bidiagonal matrix computed during the bidiagonalization stage; contains the total number of iterations taken by the algorithm.

The rest of the array is used as internal workspace.

Raises
NagValueError
(errno )

On entry, and .

Constraint: if , .

(errno )

On entry, , and .

Constraint: if , .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

Warns
NagAlgorithmicWarning
(errno )

The algorithm has failed to converge. singular values have not been found.

Notes

No equivalent traditional C interface for this routine exists in the NAG Library.

The upper triangular matrix is factorized as

where and are orthogonal matrices and is an diagonal matrix with non-negative diagonal elements, , ordered such that

The columns of are the left-hand singular vectors of , the diagonal elements of are the singular values of and the columns of are the right-hand singular vectors of .

Either or both of and may be requested and the matrix given by

where is an given matrix, may also be requested.

The function obtains the singular value decomposition by first reducing to bidiagonal form by means of Givens plane rotations and then using the algorithm to obtain the singular value decomposition of the bidiagonal form.

Good background descriptions to the singular value decomposition are given in Chan (1982), Dongarra et al. (1979), Golub and Van Loan (1996), Hammarling (1985) and Wilkinson (1978).

Note that if is any orthogonal diagonal matrix so that

(that is the diagonal elements of are or ) then

is also a singular value decomposition of .

References

Chan, T F, 1982, An improved algorithm for computing the singular value decomposition, ACM Trans. Math. Software (8), 72–83

Dongarra, J J, Moler, C B, Bunch, J R and Stewart, G W, 1979, LINPACK Users’ Guide, SIAM, Philadelphia

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

Hammarling, S, 1985, The singular value decomposition in multivariate statistics, SIGNUM Newsl. (20(3)), 2–25

Wilkinson, J H, 1978, Singular Value Decomposition – Basic Aspects, Numerical Software – Needs and Availability, (ed D A H Jacobs), Academic Press