gelsy#

Functions

void sgelsy(
    const INT           m,
    const INT           n,
    const INT           nrhs,
          f32* restrict A,
    const INT           lda,
          f32* restrict B,
    const INT           ldb,
          INT* restrict jpvt,
    const f32           rcond,
          INT*          rank,
          f32* restrict work,
    const INT           lwork,
          INT*          info
);
void sgelsy(const INT m, const INT n, const INT nrhs, f32 *restrict A, const INT lda, f32 *restrict B, const INT ldb, INT *restrict jpvt, const f32 rcond, INT *rank, f32 *restrict work, const INT lwork, INT *info)#

SGELSY computes the minimum-norm solution to a real linear least squares problem: minimize || A * X - B || using a complete orthogonal factorization of A.

A is an M-by-N matrix which may be rank-deficient.

The routine first computes a QR factorization with column pivoting: A * P = Q * [ R11 R12 ] [ 0 R22 ] with R11 defined as the largest leading submatrix whose estimated condition number is less than 1/RCOND. The order of R11, RANK, is the effective rank of A.

Then, R22 is considered to be negligible, and R12 is annihilated by orthogonal transformations from the right, arriving at the complete orthogonal factorization: A * P = Q * [ T11 0 ] * Z [ 0 0 ] The minimum-norm solution is then X = P * Z^T * [ inv(T11)*Q1^T*B ] [ 0 ] where Q1 consists of the first RANK columns of Q.

Parameters

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 details of the complete orthogonal factorization.

in
lda

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

inout
B

Double precision array, dimension (ldb, nrhs). On entry, the m-by-nrhs right hand side matrix. On exit, the n-by-nrhs solution matrix X.

in
ldb

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

inout
jpvt

Integer array, dimension (n). On entry, if jpvt[i] != 0, the i-th column of A is permuted to the front of AP; otherwise column i is free. On exit, if jpvt[i] = k, then the i-th column of A*P was the k-th column of A (0-based).

in
rcond

Used to determine effective rank of A. Columns whose condition number exceeds 1/rcond are treated as zero.

out
rank

The effective rank of A, i.e., the order of R11.

out
work

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

in
lwork

Dimension of work. If lwork == -1, workspace query only.

out
info

  • = 0: successful exit

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

Functions

void dgelsy(
    const INT           m,
    const INT           n,
    const INT           nrhs,
          f64* restrict A,
    const INT           lda,
          f64* restrict B,
    const INT           ldb,
          INT* restrict jpvt,
    const f64           rcond,
          INT*          rank,
          f64* restrict work,
    const INT           lwork,
          INT*          info
);
void dgelsy(const INT m, const INT n, const INT nrhs, f64 *restrict A, const INT lda, f64 *restrict B, const INT ldb, INT *restrict jpvt, const f64 rcond, INT *rank, f64 *restrict work, const INT lwork, INT *info)#

DGELSY computes the minimum-norm solution to a real linear least squares problem: minimize || A * X - B || using a complete orthogonal factorization of A.

A is an M-by-N matrix which may be rank-deficient.

The routine first computes a QR factorization with column pivoting: A * P = Q * [ R11 R12 ] [ 0 R22 ] with R11 defined as the largest leading submatrix whose estimated condition number is less than 1/RCOND. The order of R11, RANK, is the effective rank of A.

Then, R22 is considered to be negligible, and R12 is annihilated by orthogonal transformations from the right, arriving at the complete orthogonal factorization: A * P = Q * [ T11 0 ] * Z [ 0 0 ] The minimum-norm solution is then X = P * Z^T * [ inv(T11)*Q1^T*B ] [ 0 ] where Q1 consists of the first RANK columns of Q.

Parameters

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 details of the complete orthogonal factorization.

in
lda

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

inout
B

Double precision array, dimension (ldb, nrhs). On entry, the m-by-nrhs right hand side matrix. On exit, the n-by-nrhs solution matrix X.

in
ldb

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

inout
jpvt

Integer array, dimension (n). On entry, if jpvt[i] != 0, the i-th column of A is permuted to the front of AP; otherwise column i is free. On exit, if jpvt[i] = k, then the i-th column of A*P was the k-th column of A (0-based).

in
rcond

Used to determine effective rank of A. Columns whose condition number exceeds 1/rcond are treated as zero.

out
rank

The effective rank of A, i.e., the order of R11.

out
work

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

in
lwork

Dimension of work. If lwork == -1, workspace query only.

out
info

  • = 0: successful exit

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

Functions

void cgelsy(
    const INT           m,
    const INT           n,
    const INT           nrhs,
          c64* restrict A,
    const INT           lda,
          c64* restrict B,
    const INT           ldb,
          INT* restrict jpvt,
    const f32           rcond,
          INT*          rank,
          c64* restrict work,
    const INT           lwork,
          f32* restrict rwork,
          INT*          info
);
void cgelsy(const INT m, const INT n, const INT nrhs, c64 *restrict A, const INT lda, c64 *restrict B, const INT ldb, INT *restrict jpvt, const f32 rcond, INT *rank, c64 *restrict work, const INT lwork, f32 *restrict rwork, INT *info)#

CGELSY computes the minimum-norm solution to a complex linear least squares problem: minimize || A * X - B || using a complete orthogonal factorization of A.

A is an M-by-N matrix which may be rank-deficient.

Several right hand side vectors b and solution vectors x can be handled in a single call; they are stored as the columns of the M-by-NRHS right hand side matrix B and the N-by-NRHS solution matrix X.

The routine first computes a QR factorization with column pivoting: A * P = Q * [ R11 R12 ] [ 0 R22 ] with R11 defined as the largest leading submatrix whose estimated condition number is less than 1/RCOND. The order of R11, RANK, is the effective rank of A.

Then, R22 is considered to be negligible, and R12 is annihilated by unitary transformations from the right, arriving at the complete orthogonal factorization: A * P = Q * [ T11 0 ] * Z [ 0 0 ] The minimum-norm solution is then X = P * Z**H [ inv(T11)*Q1**H*B ] [ 0 ] where Q1 consists of the first RANK columns of Q.

Parameters

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 array, dimension (lda, n). On entry, the m-by-n matrix A. On exit, overwritten by details of the complete orthogonal factorization.

in
lda

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

inout
B

Complex array, dimension (ldb, nrhs). On entry, the m-by-nrhs right hand side matrix. On exit, the n-by-nrhs solution matrix X.

in
ldb

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

inout
jpvt

Integer array, dimension (n). On entry, if jpvt[i] != 0, the i-th column of A is permuted to the front of AP; otherwise column i is free. On exit, if jpvt[i] = k, then the i-th column of A*P was the k-th column of A (0-based).

in
rcond

Used to determine effective rank of A. Columns whose condition number exceeds 1/rcond are treated as zero.

out
rank

The effective rank of A, i.e., the order of R11.

out
work

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

in
lwork

Dimension of work. If lwork == -1, workspace query only.

out
rwork

Single precision array, dimension (2*n).

out
info

  • = 0: successful exit

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

Functions

void zgelsy(
    const INT            m,
    const INT            n,
    const INT            nrhs,
          c128* restrict A,
    const INT            lda,
          c128* restrict B,
    const INT            ldb,
          INT*  restrict jpvt,
    const f64            rcond,
          INT*           rank,
          c128* restrict work,
    const INT            lwork,
          f64*  restrict rwork,
          INT*           info
);
void zgelsy(const INT m, const INT n, const INT nrhs, c128 *restrict A, const INT lda, c128 *restrict B, const INT ldb, INT *restrict jpvt, const f64 rcond, INT *rank, c128 *restrict work, const INT lwork, f64 *restrict rwork, INT *info)#

ZGELSY computes the minimum-norm solution to a complex linear least squares problem: minimize || A * X - B || using a complete orthogonal factorization of A.

A is an M-by-N matrix which may be rank-deficient.

Several right hand side vectors b and solution vectors x can be handled in a single call; they are stored as the columns of the M-by-NRHS right hand side matrix B and the N-by-NRHS solution matrix X.

The routine first computes a QR factorization with column pivoting: A * P = Q * [ R11 R12 ] [ 0 R22 ] with R11 defined as the largest leading submatrix whose estimated condition number is less than 1/RCOND. The order of R11, RANK, is the effective rank of A.

Then, R22 is considered to be negligible, and R12 is annihilated by unitary transformations from the right, arriving at the complete orthogonal factorization: A * P = Q * [ T11 0 ] * Z [ 0 0 ] The minimum-norm solution is then X = P * Z**H [ inv(T11)*Q1**H*B ] [ 0 ] where Q1 consists of the first RANK columns of Q.

Parameters

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 array, dimension (lda, n). On entry, the m-by-n matrix A. On exit, overwritten by details of the complete orthogonal factorization.

in
lda

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

inout
B

Complex array, dimension (ldb, nrhs). On entry, the m-by-nrhs right hand side matrix. On exit, the n-by-nrhs solution matrix X.

in
ldb

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

inout
jpvt

Integer array, dimension (n). On entry, if jpvt[i] != 0, the i-th column of A is permuted to the front of AP; otherwise column i is free. On exit, if jpvt[i] = k, then the i-th column of A*P was the k-th column of A (0-based).

in
rcond

Used to determine effective rank of A. Columns whose condition number exceeds 1/rcond are treated as zero.

out
rank

The effective rank of A, i.e., the order of R11.

out
work

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

in
lwork

Dimension of work. If lwork == -1, workspace query only.

out
rwork

Double precision array, dimension (2*n).

out
info

  • = 0: successful exit

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