gglse#

Functions

void sgglse(
    const INT           m,
    const INT           n,
    const INT           p,
          f32* restrict A,
    const INT           lda,
          f32* restrict B,
    const INT           ldb,
          f32* restrict C,
          f32* restrict D,
          f32* restrict X,
          f32* restrict work,
    const INT           lwork,
          INT*          info
);
void sgglse(const INT m, const INT n, const INT p, f32 *restrict A, const INT lda, f32 *restrict B, const INT ldb, f32 *restrict C, f32 *restrict D, f32 *restrict X, f32 *restrict work, const INT lwork, INT *info)#

SGGLSE solves the linear equality-constrained least squares (LSE) problem:

    minimize || c - A*x ||_2   subject to   B*x = d
where A is an M-by-N matrix, B is a P-by-N matrix, c is a given M-vector, and d is a given P-vector. It is assumed that P <= N <= M+P, and
     rank(B) = P and  rank( (A) ) = N.
                          ( (B) )
These conditions ensure that the LSE problem has a unique solution, which is obtained using a generalized RQ factorization of the matrices (B, A) given by

B = (0 R)*Q, A = Z*T*Q.

If lwork = -1, then a workspace query is assumed; the routine only calculates the optimal size of the work array, returns this value as the first entry of the work array, and no error message related to lwork is issued by xerbla.

Parameters

in
m

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

in
n

The number of columns of the matrices A and B. n >= 0.

in
p

The number of rows of the matrix B. 0 <= p <= n <= m+p.

inout
A

Double precision array, dimension (lda, n). On entry, the M-by-N matrix A. On exit, the elements on and above the diagonal of the array contain the min(M,N)-by-N upper trapezoidal matrix T.

in
lda

The leading dimension of the array A. lda >= max(1, m).

inout
B

Double precision array, dimension (ldb, n). On entry, the P-by-N matrix B. On exit, the upper triangle of the subarray B(1:P,N-P+1:N) contains the P-by-P upper triangular matrix R.

in
ldb

The leading dimension of the array B. ldb >= max(1, p).

inout
C

Double precision array, dimension (m). On entry, C contains the right hand side vector for the least squares part of the LSE problem. On exit, the residual sum of squares for the solution is given by the sum of squares of elements N-P+1 to M of vector C.

inout
D

Double precision array, dimension (p). On entry, D contains the right hand side vector for the constrained equation. On exit, D is destroyed.

out
X

Double precision array, dimension (n). On exit, X is the solution of the LSE problem.

out
work

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

in
lwork

The dimension of the array work. lwork >= max(1, m+n+p). For optimum performance lwork >= p+min(m,n)+max(m,n)*NB, where NB is an upper bound for the optimal blocksizes for SGEQRF, SGERQF, SORMQR and SORMRQ.

out
info

  • = 0: successful exit.

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

  • = 1: the upper triangular factor R associated with B in the generalized RQ factorization of the pair (B, A) is exactly singular, so that rank(B) < P; the least squares solution could not be computed.

  • = 2: the (N-P) by (N-P) part of the upper trapezoidal factor T associated with A in the generalized RQ factorization of the pair (B, A) is exactly singular, so that rank( (A) ) < N; the least squares solution could not ( (B) ) be computed.

Functions

void dgglse(
    const INT           m,
    const INT           n,
    const INT           p,
          f64* restrict A,
    const INT           lda,
          f64* restrict B,
    const INT           ldb,
          f64* restrict C,
          f64* restrict D,
          f64* restrict X,
          f64* restrict work,
    const INT           lwork,
          INT*          info
);
void dgglse(const INT m, const INT n, const INT p, f64 *restrict A, const INT lda, f64 *restrict B, const INT ldb, f64 *restrict C, f64 *restrict D, f64 *restrict X, f64 *restrict work, const INT lwork, INT *info)#

DGGLSE solves the linear equality-constrained least squares (LSE) problem:

    minimize || c - A*x ||_2   subject to   B*x = d
where A is an M-by-N matrix, B is a P-by-N matrix, c is a given M-vector, and d is a given P-vector. It is assumed that P <= N <= M+P, and
     rank(B) = P and  rank( (A) ) = N.
                          ( (B) )
These conditions ensure that the LSE problem has a unique solution, which is obtained using a generalized RQ factorization of the matrices (B, A) given by

B = (0 R)*Q, A = Z*T*Q.

If lwork = -1, then a workspace query is assumed; the routine only calculates the optimal size of the work array, returns this value as the first entry of the work array, and no error message related to lwork is issued by xerbla.

Parameters

in
m

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

in
n

The number of columns of the matrices A and B. n >= 0.

in
p

The number of rows of the matrix B. 0 <= p <= n <= m+p.

inout
A

Double precision array, dimension (lda, n). On entry, the M-by-N matrix A. On exit, the elements on and above the diagonal of the array contain the min(M,N)-by-N upper trapezoidal matrix T.

in
lda

The leading dimension of the array A. lda >= max(1, m).

inout
B

Double precision array, dimension (ldb, n). On entry, the P-by-N matrix B. On exit, the upper triangle of the subarray B(1:P,N-P+1:N) contains the P-by-P upper triangular matrix R.

in
ldb

The leading dimension of the array B. ldb >= max(1, p).

inout
C

Double precision array, dimension (m). On entry, C contains the right hand side vector for the least squares part of the LSE problem. On exit, the residual sum of squares for the solution is given by the sum of squares of elements N-P+1 to M of vector C.

inout
D

Double precision array, dimension (p). On entry, D contains the right hand side vector for the constrained equation. On exit, D is destroyed.

out
X

Double precision array, dimension (n). On exit, X is the solution of the LSE problem.

out
work

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

in
lwork

The dimension of the array work. lwork >= max(1, m+n+p). For optimum performance lwork >= p+min(m,n)+max(m,n)*NB, where NB is an upper bound for the optimal blocksizes for DGEQRF, DGERQF, DORMQR and DORMRQ.

out
info

  • = 0: successful exit.

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

  • = 1: the upper triangular factor R associated with B in the generalized RQ factorization of the pair (B, A) is exactly singular, so that rank(B) < P; the least squares solution could not be computed.

  • = 2: the (N-P) by (N-P) part of the upper trapezoidal factor T associated with A in the generalized RQ factorization of the pair (B, A) is exactly singular, so that rank( (A) ) < N; the least squares solution could not ( (B) ) be computed.

Functions

void cgglse(
    const INT           m,
    const INT           n,
    const INT           p,
          c64* restrict A,
    const INT           lda,
          c64* restrict B,
    const INT           ldb,
          c64* restrict C,
          c64* restrict D,
          c64* restrict X,
          c64* restrict work,
    const INT           lwork,
          INT*          info
);
void cgglse(const INT m, const INT n, const INT p, c64 *restrict A, const INT lda, c64 *restrict B, const INT ldb, c64 *restrict C, c64 *restrict D, c64 *restrict X, c64 *restrict work, const INT lwork, INT *info)#

CGGLSE solves the linear equality-constrained least squares (LSE) problem:

    minimize || c - A*x ||_2   subject to   B*x = d
where A is an M-by-N matrix, B is a P-by-N matrix, c is a given M-vector, and d is a given P-vector. It is assumed that P <= N <= M+P, and
     rank(B) = P and  rank( (A) ) = N.
                          ( (B) )
These conditions ensure that the LSE problem has a unique solution, which is obtained using a generalized RQ factorization of the matrices (B, A) given by

B = (0 R)*Q, A = Z*T*Q.

If lwork = -1, then a workspace query is assumed; the routine only calculates the optimal size of the work array, returns this value as the first entry of the work array, and no error message related to lwork is issued by xerbla.

Parameters

in
m

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

in
n

The number of columns of the matrices A and B. n >= 0.

in
p

The number of rows of the matrix B. 0 <= p <= n <= m+p.

inout
A

Single complex array, dimension (lda, n). On entry, the M-by-N matrix A. On exit, the elements on and above the diagonal of the array contain the min(M,N)-by-N upper trapezoidal matrix T.

in
lda

The leading dimension of the array A. lda >= max(1, m).

inout
B

Single complex array, dimension (ldb, n). On entry, the P-by-N matrix B. On exit, the upper triangle of the subarray B(1:P,N-P+1:N) contains the P-by-P upper triangular matrix R.

in
ldb

The leading dimension of the array B. ldb >= max(1, p).

inout
C

Single complex array, dimension (m). On entry, C contains the right hand side vector for the least squares part of the LSE problem. On exit, the residual sum of squares for the solution is given by the sum of squares of elements N-P+1 to M of vector C.

inout
D

Single complex array, dimension (p). On entry, D contains the right hand side vector for the constrained equation. On exit, D is destroyed.

out
X

Single complex array, dimension (n). On exit, X is the solution of the LSE problem.

out
work

Single complex array, dimension (max(1, lwork)). On exit, if info = 0, work[0] returns the optimal lwork.

in
lwork

The dimension of the array work. lwork >= max(1, m+n+p). For optimum performance lwork >= p+min(m,n)+max(m,n)*NB, where NB is an upper bound for the optimal blocksizes for CGEQRF, CGERQF, CUNMQR and CUNMRQ.

out
info

  • = 0: successful exit.

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

  • = 1: the upper triangular factor R associated with B in the generalized RQ factorization of the pair (B, A) is exactly singular, so that rank(B) < P; the least squares solution could not be computed.

  • = 2: the (N-P) by (N-P) part of the upper trapezoidal factor T associated with A in the generalized RQ factorization of the pair (B, A) is exactly singular, so that rank( (A) ) < N; the least squares solution could not ( (B) ) be computed.

Functions

void zgglse(
    const INT            m,
    const INT            n,
    const INT            p,
          c128* restrict A,
    const INT            lda,
          c128* restrict B,
    const INT            ldb,
          c128* restrict C,
          c128* restrict D,
          c128* restrict X,
          c128* restrict work,
    const INT            lwork,
          INT*           info
);
void zgglse(const INT m, const INT n, const INT p, c128 *restrict A, const INT lda, c128 *restrict B, const INT ldb, c128 *restrict C, c128 *restrict D, c128 *restrict X, c128 *restrict work, const INT lwork, INT *info)#

ZGGLSE solves the linear equality-constrained least squares (LSE) problem:

    minimize || c - A*x ||_2   subject to   B*x = d
where A is an M-by-N matrix, B is a P-by-N matrix, c is a given M-vector, and d is a given P-vector. It is assumed that P <= N <= M+P, and
     rank(B) = P and  rank( (A) ) = N.
                          ( (B) )
These conditions ensure that the LSE problem has a unique solution, which is obtained using a generalized RQ factorization of the matrices (B, A) given by

B = (0 R)*Q, A = Z*T*Q.

If lwork = -1, then a workspace query is assumed; the routine only calculates the optimal size of the work array, returns this value as the first entry of the work array, and no error message related to lwork is issued by xerbla.

Parameters

in
m

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

in
n

The number of columns of the matrices A and B. n >= 0.

in
p

The number of rows of the matrix B. 0 <= p <= n <= m+p.

inout
A

Double complex array, dimension (lda, n). On entry, the M-by-N matrix A. On exit, the elements on and above the diagonal of the array contain the min(M,N)-by-N upper trapezoidal matrix T.

in
lda

The leading dimension of the array A. lda >= max(1, m).

inout
B

Double complex array, dimension (ldb, n). On entry, the P-by-N matrix B. On exit, the upper triangle of the subarray B(1:P,N-P+1:N) contains the P-by-P upper triangular matrix R.

in
ldb

The leading dimension of the array B. ldb >= max(1, p).

inout
C

Double complex array, dimension (m). On entry, C contains the right hand side vector for the least squares part of the LSE problem. On exit, the residual sum of squares for the solution is given by the sum of squares of elements N-P+1 to M of vector C.

inout
D

Double complex array, dimension (p). On entry, D contains the right hand side vector for the constrained equation. On exit, D is destroyed.

out
X

Double complex array, dimension (n). On exit, X is the solution of the LSE problem.

out
work

Double complex array, dimension (max(1, lwork)). On exit, if info = 0, work[0] returns the optimal lwork.

in
lwork

The dimension of the array work. lwork >= max(1, m+n+p). For optimum performance lwork >= p+min(m,n)+max(m,n)*NB, where NB is an upper bound for the optimal blocksizes for ZGEQRF, ZGERQF, ZUNMQR and ZUNMRQ.

out
info

  • = 0: successful exit.

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

  • = 1: the upper triangular factor R associated with B in the generalized RQ factorization of the pair (B, A) is exactly singular, so that rank(B) < P; the least squares solution could not be computed.

  • = 2: the (N-P) by (N-P) part of the upper trapezoidal factor T associated with A in the generalized RQ factorization of the pair (B, A) is exactly singular, so that rank( (A) ) < N; the least squares solution could not ( (B) ) be computed.