Previous: sgghrd Up: ../lapack-s.html Next: sggqrf

# sgglse

```
NAME
SGGLSE - solve the linear equality constrained least squares
(LSE) problem

SYNOPSIS
SUBROUTINE SGGLSE( M, N, P, A, LDA, B, LDB, C, D, X, WORK,
LWORK, INFO )

INTEGER        INFO, LDA, LDB, LWORK, M, N, P

REAL           A( LDA, * ), B( LDB, * ), C( * ), D( * ),
WORK( * ), X( * )

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

minimize || A*x - c ||_2   subject to B*x = d

using a generalized RQ factorization of matrices A and B,
where A is M-by-N, B is P-by-N, assume P <= N <= M+P, and
||.||_2 denotes vector 2-norm. It is assumed that

rank(B) = P
(1)

and the null spaces of A and B intersect only trivially,
i.e.,

intersection of Null(A) and Null(B) = {0} <=> rank( ( A ) )
= N  (2)
( ( B ) )

where N(A) denotes the null space of matrix A. Conditions
(1) and (2) ensure that the problem LSE has a unique solu-
tion.

ARGUMENTS
M       (input) INTEGER
The number of rows of the matrix A.  M >= 0.

N       (input) INTEGER
The number of columns of the matrices A and B. N >=
0.  Assume that P <= N <= M+P.

P       (input) INTEGER
The number of rows of the matrix B.  P >= 0.

A       (input/output) REAL array, dimension (LDA,N)
On entry, the P-by-M matrix A.  On exit, A is des-
troyed.

LDA     (input) INTEGER
The leading dimension of the array A. LDA >=
max(1,M).

B       (input/output) REAL array, dimension (LDB,N)
On entry, the P-by-N matrix B.  On exit, B is des-
troyed.

LDB     (input) INTEGER
The leading dimension of the array B. LDB >=
max(1,P).

C       (input/output) REAL 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.

D       (input/output) REAL array, dimension (P)
On entry, D contains the right hand side vector for
the constrained equation.  On exit, D is destroyed.

X       (output) REAL array, dimension (N)
On exit, X is the solution of the LSE problem.

WORK    (workspace) REAL array, dimension (LWORK)
On exit, if INFO = 0, WORK(1) returns the optimal
LWORK.

LWORK   (input) INTEGER
The dimension of the array WORK. LWORK >=
N+P+max(N,M,P).  For optimum performance LWORK >=
N+P+max(M,P,N)*max(NB1,NB2), where NB1 is the
optimal blocksize for the QR factorization of M-by-N
matrix A.  NB2 is the optimal blocksize for the RQ
factorization of P-by-N matrix B.

INFO    (output) INTEGER
= 0:  successful exit.
< 0:  if INFO = -i, the i-th argument had an illegal
value.
```