# naginterfaces.library.lapackeig.dgels¶

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

dgels solves linear least squares problems of the form

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

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

https://www.nag.com/numeric/nl/nagdoc_28.7/flhtml/f08/f08aaf.html

Parameters
transstr, length 1

If , the linear system involves .

If , the linear system involves .

afloat, array-like, shape

The matrix .

bfloat, array-like, shape

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

Returns
afloat, ndarray, shape

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

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

bfloat, 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: .

Warns
NagAlgorithmicWarning
(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