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

complex_triang_svd returns all, or part, of the singular value decomposition of a complex upper triangular matrix.

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


, the order of the matrix .

If , an immediate return is effected.

acomplex, array-like, shape

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

bcomplex, array-like, shape

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

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


Must be if the matrix is required.

If then the array is not referenced.


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

acomplex, ndarray, shape

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

bcomplex, ndarray, shape

Is overwritten by the matrix .

qcomplex, ndarray, shape

If , the leading part of the array will contain the unitary matrix . Otherwise the array is not referenced.

svfloat, ndarray, shape

The diagonal elements of the matrix .

rworkfloat, ndarray, shape

contains the total number of iterations taken by the algorithm.

The rest of the array is used as workspace.

(errno )

On entry, and .

Constraint: if , .

(errno )

On entry, , and .

Constraint: if , .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

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


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

The upper triangular matrix is factorized as

where and are unitary matrices and is an diagonal matrix with real 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.

complex_triang_svd 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 Dongarra et al. (1979), Hammarling (1985) and Wilkinson (1978).

Note that if is any unitary diagonal matrix so that


is also a singular value decomposition of .


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

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