ggglm#

Functions

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

SGGGLM solves a general Gauss-Markov linear model (GLM) problem:

    minimize || y ||_2   subject to   d = A*x + B*y
        x
where A is an N-by-M matrix, B is an N-by-P matrix, and d is a given N-vector. It is assumed that M <= N <= M+P, and
       rank(A) = M    and    rank( A B ) = N.
Under these assumptions, the constrained equation is always consistent, and there is a unique solution x and a minimal 2-norm solution y, which is obtained using a generalized QR factorization of the matrices (A, B) given by

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

In particular, if matrix B is square nonsingular, then the problem GLM is equivalent to the following weighted linear least squares problem

         minimize || inv(B)*(d-A*x) ||_2
             x
where inv(B) denotes the inverse of B.

On exit, X and Y are the solutions of the GLM problem.

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
n

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

in
m

The number of columns of the matrix A. 0 <= m <= n.

in
p

The number of columns of the matrix B. p >= n-m.

inout
A

Double precision array, dimension (lda, m). On entry, the N-by-M matrix A. On exit, the upper triangular part of the array A contains the M-by-M upper triangular matrix R.

in
lda

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

inout
B

Double precision array, dimension (ldb, p). On entry, the N-by-P matrix B. On exit, if n <= p, the upper triangle of the subarray B(1:n, p-n+1:p) contains the N-by-N upper triangular matrix T; if n > p, the elements on and above the (n-p)th subdiagonal contain the N-by-P upper trapezoidal matrix T.

in
ldb

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

inout
D

Double precision array, dimension (n). On entry, D is the left hand side of the GLM equation. On exit, D is destroyed.

out
X

Double precision array, dimension (m).

out
Y

Double precision array, dimension (p).

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, n+m+p). For optimum performance, lwork >= m+min(n,p)+max(n,p)*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 A in the generalized QR factorization of the pair (A, B) is exactly singular, so that rank(A) < M; the least squares solution could not be computed.

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

Functions

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

DGGGLM solves a general Gauss-Markov linear model (GLM) problem:

    minimize || y ||_2   subject to   d = A*x + B*y
        x
where A is an N-by-M matrix, B is an N-by-P matrix, and d is a given N-vector. It is assumed that M <= N <= M+P, and
       rank(A) = M    and    rank( A B ) = N.
Under these assumptions, the constrained equation is always consistent, and there is a unique solution x and a minimal 2-norm solution y, which is obtained using a generalized QR factorization of the matrices (A, B) given by

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

In particular, if matrix B is square nonsingular, then the problem GLM is equivalent to the following weighted linear least squares problem

         minimize || inv(B)*(d-A*x) ||_2
             x
where inv(B) denotes the inverse of B.

On exit, X and Y are the solutions of the GLM problem.

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
n

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

in
m

The number of columns of the matrix A. 0 <= m <= n.

in
p

The number of columns of the matrix B. p >= n-m.

inout
A

Double precision array, dimension (lda, m). On entry, the N-by-M matrix A. On exit, the upper triangular part of the array A contains the M-by-M upper triangular matrix R.

in
lda

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

inout
B

Double precision array, dimension (ldb, p). On entry, the N-by-P matrix B. On exit, if n <= p, the upper triangle of the subarray B(1:n, p-n+1:p) contains the N-by-N upper triangular matrix T; if n > p, the elements on and above the (n-p)th subdiagonal contain the N-by-P upper trapezoidal matrix T.

in
ldb

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

inout
D

Double precision array, dimension (n). On entry, D is the left hand side of the GLM equation. On exit, D is destroyed.

out
X

Double precision array, dimension (m).

out
Y

Double precision array, dimension (p).

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, n+m+p). For optimum performance, lwork >= m+min(n,p)+max(n,p)*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 A in the generalized QR factorization of the pair (A, B) is exactly singular, so that rank(A) < M; the least squares solution could not be computed.

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

Functions

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

CGGGLM solves a general Gauss-Markov linear model (GLM) problem:

    minimize || y ||_2   subject to   d = A*x + B*y
        x
where A is an N-by-M matrix, B is an N-by-P matrix, and d is a given N-vector. It is assumed that M <= N <= M+P, and
       rank(A) = M    and    rank( A B ) = N.
Under these assumptions, the constrained equation is always consistent, and there is a unique solution x and a minimal 2-norm solution y, which is obtained using a generalized QR factorization of the matrices (A, B) given by

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

In particular, if matrix B is square nonsingular, then the problem GLM is equivalent to the following weighted linear least squares problem

         minimize || inv(B)*(d-A*x) ||_2
             x
where inv(B) denotes the inverse of B.

On exit, X and Y are the solutions of the GLM problem.

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
n

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

in
m

The number of columns of the matrix A. 0 <= m <= n.

in
p

The number of columns of the matrix B. p >= n-m.

inout
A

Single complex array, dimension (lda, m). On entry, the N-by-M matrix A. On exit, the upper triangular part of the array A contains the M-by-M upper triangular matrix R.

in
lda

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

inout
B

Single complex array, dimension (ldb, p). On entry, the N-by-P matrix B. On exit, if n <= p, the upper triangle of the subarray B(1:n, p-n+1:p) contains the N-by-N upper triangular matrix T; if n > p, the elements on and above the (n-p)th subdiagonal contain the N-by-P upper trapezoidal matrix T.

in
ldb

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

inout
D

Single complex array, dimension (n). On entry, D is the left hand side of the GLM equation. On exit, D is destroyed.

out
X

Single complex array, dimension (m).

out
Y

Single complex array, dimension (p).

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, n+m+p). For optimum performance, lwork >= m+min(n,p)+max(n,p)*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 A in the generalized QR factorization of the pair (A, B) is exactly singular, so that rank(A) < M; the least squares solution could not be computed.

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

Functions

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

ZGGGLM solves a general Gauss-Markov linear model (GLM) problem:

    minimize || y ||_2   subject to   d = A*x + B*y
        x
where A is an N-by-M matrix, B is an N-by-P matrix, and d is a given N-vector. It is assumed that M <= N <= M+P, and
       rank(A) = M    and    rank( A B ) = N.
Under these assumptions, the constrained equation is always consistent, and there is a unique solution x and a minimal 2-norm solution y, which is obtained using a generalized QR factorization of the matrices (A, B) given by

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

In particular, if matrix B is square nonsingular, then the problem GLM is equivalent to the following weighted linear least squares problem

         minimize || inv(B)*(d-A*x) ||_2
             x
where inv(B) denotes the inverse of B.

On exit, X and Y are the solutions of the GLM problem.

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
n

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

in
m

The number of columns of the matrix A. 0 <= m <= n.

in
p

The number of columns of the matrix B. p >= n-m.

inout
A

Double complex array, dimension (lda, m). On entry, the N-by-M matrix A. On exit, the upper triangular part of the array A contains the M-by-M upper triangular matrix R.

in
lda

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

inout
B

Double complex array, dimension (ldb, p). On entry, the N-by-P matrix B. On exit, if n <= p, the upper triangle of the subarray B(1:n, p-n+1:p) contains the N-by-N upper triangular matrix T; if n > p, the elements on and above the (n-p)th subdiagonal contain the N-by-P upper trapezoidal matrix T.

in
ldb

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

inout
D

Double complex array, dimension (n). On entry, D is the left hand side of the GLM equation. On exit, D is destroyed.

out
X

Double complex array, dimension (m).

out
Y

Double complex array, dimension (p).

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, n+m+p). For optimum performance, lwork >= m+min(n,p)+max(n,p)*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 A in the generalized QR factorization of the pair (A, B) is exactly singular, so that rank(A) < M; the least squares solution could not be computed.

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