gels#

Functions

void sgels(
    const char*          trans,
    const INT            m,
    const INT            n,
    const INT            nrhs,
          f32*  restrict A,
    const INT            lda,
          f32*  restrict B,
    const INT            ldb,
          f32*  restrict work,
    const INT            lwork,
          INT*           info
);
void sgels(const char *trans, const INT m, const INT n, const INT nrhs, f32 *restrict A, const INT lda, f32 *restrict B, const INT ldb, f32 *restrict work, const INT lwork, INT *info)#

SGELS solves overdetermined or underdetermined real linear systems involving an M-by-N matrix A, or its transpose, using a QR or LQ factorization of A.

It is assumed that A has full rank, and only a rudimentary protection against rank-deficient matrices is provided.

The following options are provided:

  1. If TRANS = ‘N’ and m >= n: find the least squares solution of an overdetermined system, minimize || B - A*X ||.

  2. If TRANS = ‘N’ and m < n: find the minimum norm solution of an underdetermined system A * X = B.

  3. If TRANS = ‘T’ and m >= n: find the minimum norm solution of an underdetermined system A^T * X = B.

  4. If TRANS = ‘T’ and m < n: find the least squares solution of an overdetermined system, minimize || B - A^T * X ||.

Parameters

in
trans

‘N’: the linear system involves A; ‘T’: the linear system involves A^T.

in
m

The number of rows of A. m >= 0.

in
n

The number of columns of A. n >= 0.

in
nrhs

The number of right hand sides. nrhs >= 0.

inout
A

Double precision array, dimension (lda, n). On entry, the m-by-n matrix A. On exit, overwritten by its QR or LQ factorization.

in
lda

Leading dimension of A. lda >= max(1, m).

inout
B

Double precision array, dimension (ldb, nrhs). On entry, the right hand side matrix B. On exit, overwritten by the solution vectors.

in
ldb

Leading dimension of B. ldb >= max(1, m, n).

out
work

Double precision array, dimension (max(1, lwork)). On exit, work[0] returns the optimal lwork.

in
lwork

Dimension of work. lwork >= max(1, mn + max(mn, nrhs)). If lwork == -1, workspace query only.

out
info

  • = 0: successful exit

  • < 0: if info = -i, the i-th argument had an illegal value

  • > 0: if info = i, the i-th diagonal element of the triangular factor of A is zero, so A does not have full rank.

Functions

void dgels(
    const char*          trans,
    const INT            m,
    const INT            n,
    const INT            nrhs,
          f64*  restrict A,
    const INT            lda,
          f64*  restrict B,
    const INT            ldb,
          f64*  restrict work,
    const INT            lwork,
          INT*           info
);
void dgels(const char *trans, const INT m, const INT n, const INT nrhs, f64 *restrict A, const INT lda, f64 *restrict B, const INT ldb, f64 *restrict work, const INT lwork, INT *info)#

DGELS solves overdetermined or underdetermined real linear systems involving an M-by-N matrix A, or its transpose, using a QR or LQ factorization of A.

It is assumed that A has full rank, and only a rudimentary protection against rank-deficient matrices is provided.

The following options are provided:

  1. If TRANS = ‘N’ and m >= n: find the least squares solution of an overdetermined system, minimize || B - A*X ||.

  2. If TRANS = ‘N’ and m < n: find the minimum norm solution of an underdetermined system A * X = B.

  3. If TRANS = ‘T’ and m >= n: find the minimum norm solution of an underdetermined system A^T * X = B.

  4. If TRANS = ‘T’ and m < n: find the least squares solution of an overdetermined system, minimize || B - A^T * X ||.

Parameters

in
trans

‘N’: the linear system involves A; ‘T’: the linear system involves A^T.

in
m

The number of rows of A. m >= 0.

in
n

The number of columns of A. n >= 0.

in
nrhs

The number of right hand sides. nrhs >= 0.

inout
A

Double precision array, dimension (lda, n). On entry, the m-by-n matrix A. On exit, overwritten by its QR or LQ factorization.

in
lda

Leading dimension of A. lda >= max(1, m).

inout
B

Double precision array, dimension (ldb, nrhs). On entry, the right hand side matrix B. On exit, overwritten by the solution vectors.

in
ldb

Leading dimension of B. ldb >= max(1, m, n).

out
work

Double precision array, dimension (max(1, lwork)). On exit, work[0] returns the optimal lwork.

in
lwork

Dimension of work. lwork >= max(1, mn + max(mn, nrhs)). If lwork == -1, workspace query only.

out
info

  • = 0: successful exit

  • < 0: if info = -i, the i-th argument had an illegal value

  • > 0: if info = i, the i-th diagonal element of the triangular factor of A is zero, so A does not have full rank.

Functions

void cgels(
    const char*          trans,
    const INT            m,
    const INT            n,
    const INT            nrhs,
          c64*  restrict A,
    const INT            lda,
          c64*  restrict B,
    const INT            ldb,
          c64*  restrict work,
    const INT            lwork,
          INT*           info
);
void cgels(const char *trans, const INT m, const INT n, const INT nrhs, c64 *restrict A, const INT lda, c64 *restrict B, const INT ldb, c64 *restrict work, const INT lwork, INT *info)#

CGELS solves overdetermined or underdetermined complex linear systems involving an M-by-N matrix A, or its conjugate-transpose, using a QR or LQ factorization of A.

It is assumed that A has full rank, and only a rudimentary protection against rank-deficient matrices is provided.

The following options are provided:

  1. If TRANS = ‘N’ and m >= n: find the least squares solution of an overdetermined system, minimize || B - A*X ||.

  2. If TRANS = ‘N’ and m < n: find the minimum norm solution of an underdetermined system A * X = B.

  3. If TRANS = ‘C’ and m >= n: find the minimum norm solution of an underdetermined system A^H * X = B.

  4. If TRANS = ‘C’ and m < n: find the least squares solution of an overdetermined system, minimize || B - A^H * X ||.

Parameters

in
trans

‘N’: the linear system involves A; ‘C’: the linear system involves A^H.

in
m

The number of rows of A. m >= 0.

in
n

The number of columns of A. n >= 0.

in
nrhs

The number of right hand sides. nrhs >= 0.

inout
A

Complex*16 array, dimension (lda, n). On entry, the m-by-n matrix A. On exit, overwritten by its QR or LQ factorization.

in
lda

Leading dimension of A. lda >= max(1, m).

inout
B

Complex*16 array, dimension (ldb, nrhs). On entry, the right hand side matrix B. On exit, overwritten by the solution vectors.

in
ldb

Leading dimension of B. ldb >= max(1, m, n).

out
work

Complex*16 array, dimension (max(1, lwork)). On exit, work[0] returns the optimal lwork.

in
lwork

Dimension of work. lwork >= max(1, mn + max(mn, nrhs)). If lwork == -1, workspace query only.

out
info

  • = 0: successful exit

  • < 0: if info = -i, the i-th argument had an illegal value

  • > 0: if info = i, the i-th diagonal element of the triangular factor of A is zero, so A does not have full rank.

Functions

void zgels(
    const char*          trans,
    const INT            m,
    const INT            n,
    const INT            nrhs,
          c128* restrict A,
    const INT            lda,
          c128* restrict B,
    const INT            ldb,
          c128* restrict work,
    const INT            lwork,
          INT*           info
);
void zgels(const char *trans, const INT m, const INT n, const INT nrhs, c128 *restrict A, const INT lda, c128 *restrict B, const INT ldb, c128 *restrict work, const INT lwork, INT *info)#

ZGELS solves overdetermined or underdetermined complex linear systems involving an M-by-N matrix A, or its conjugate-transpose, using a QR or LQ factorization of A.

It is assumed that A has full rank, and only a rudimentary protection against rank-deficient matrices is provided.

The following options are provided:

  1. If TRANS = ‘N’ and m >= n: find the least squares solution of an overdetermined system, minimize || B - A*X ||.

  2. If TRANS = ‘N’ and m < n: find the minimum norm solution of an underdetermined system A * X = B.

  3. If TRANS = ‘C’ and m >= n: find the minimum norm solution of an underdetermined system A^H * X = B.

  4. If TRANS = ‘C’ and m < n: find the least squares solution of an overdetermined system, minimize || B - A^H * X ||.

Parameters

in
trans

‘N’: the linear system involves A; ‘C’: the linear system involves A^H.

in
m

The number of rows of A. m >= 0.

in
n

The number of columns of A. n >= 0.

in
nrhs

The number of right hand sides. nrhs >= 0.

inout
A

Complex*16 array, dimension (lda, n). On entry, the m-by-n matrix A. On exit, overwritten by its QR or LQ factorization.

in
lda

Leading dimension of A. lda >= max(1, m).

inout
B

Complex*16 array, dimension (ldb, nrhs). On entry, the right hand side matrix B. On exit, overwritten by the solution vectors.

in
ldb

Leading dimension of B. ldb >= max(1, m, n).

out
work

Complex*16 array, dimension (max(1, lwork)). On exit, work[0] returns the optimal lwork.

in
lwork

Dimension of work. lwork >= max(1, mn + max(mn, nrhs)). If lwork == -1, workspace query only.

out
info

  • = 0: successful exit

  • < 0: if info = -i, the i-th argument had an illegal value

  • > 0: if info = i, the i-th diagonal element of the triangular factor of A is zero, so A does not have full rank.