naginterfaces.library.lapackeig.zgels

naginterfaces.library.lapackeig.zgels(trans, a, b)[source]

zgels solves linear least squares problems of the form

where is an complex matrix of full rank, using a or factorization of .

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

https://www.nag.com/numeric/nl/nagdoc_28.6/flhtml/f08/f08anf.html

Parameters
transstr, length 1

If , the linear system involves .

If , the linear system involves .

acomplex, array-like, shape

The matrix .

bcomplex, array-like, shape

The matrix of right-hand side vectors, stored in columns; is if , or if .

Returns
acomplex, ndarray, shape

If , is overwritten by details of its factorization, as returned by zgeqrf().

If , is overwritten by details of its factorization, as returned by zgelqf().

bcomplex, ndarray, shape

is overwritten by the solution vectors, , stored in columns:

if and , or and , elements to in each column of contain the least squares solution vectors; the residual sum of squares for the solution is given by the sum of squares of the modulus of elements to in that column;

otherwise, elements to in each column of contain the minimum norm solution vectors.

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 )

Diagonal element of the triangular factor of is zero, so that does not have full rank; the least squares solution could not be computed.

Notes

The following options are provided:

  1. If and : find the least squares solution of an overdetermined system, i.e., solve the least squares problem

  2. If and : find the minimum norm solution of an underdetermined system .

  3. If and : find the minimum norm solution of an undetermined system .

  4. If and : find the least squares solution of an overdetermined system, i.e., solve the least squares problem

Several right-hand side vectors and solution vectors can be handled in a single call; they are stored as the columns of the right-hand side matrix and the solution matrix .

References

Anderson, E, Bai, Z, Bischof, C, Blackford, S, Demmel, J, Dongarra, J J, Du Croz, J J, Greenbaum, A, Hammarling, S, McKenney, A and Sorensen, D, 1999, LAPACK Users’ Guide, (3rd Edition), SIAM, Philadelphia, https://www.netlib.org/lapack/lug

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