Purpose ======= LA_GGLSE solves the linear equality-constrained least squares (LSE) problem: min || c - A*x||2 subject to B*x = d, where A and B are real or complex rectangular matrices and c and d are real or complex vectors. Further, A is m by n, B is p by n, c is m by 1 and d is p by 1, and it is assumed that p <= n <= m + p, rank(B) = p, rank [ A ] = n. [ B ] These conditions ensure that the LSE problem has a unique solution x. This is obtained using the generalized RQ factorization of the matrices B and A. ========= SUBROUTINE LA_GGLSE( A, B, C, D, X, INFO=info ) (), INTENT( INOUT ) :: A(:,:), B(:,:), C(:), D(:) (), INTENT( OUT ) :: X(:) INTEGER, INTENT(OUT), OPTIONAL :: INFO where ::= REAL | COMPLEX ::= KIND(1.0) | KIND(1.0D0) Arguments ========= A (input/output) REAL or COMPLEX array, shape (:,:) with size(A,1) = m and size(A,2) = n. On entry, the matrix A. On exit, the contents of A are destroyed. B (input/output) REAL or COMPLEX array, shape (:,:) with size(B,1) = p and size(B,2) = n. On entry, the matrix B. On exit, the contents of B are destroyed. C (input/output) REAL or COMPLEX array, shape (:) with size(C) = m. On entry, the vector c. On exit, the residual sum of squares for the solution is given by the sum of squares of elements n-p+1 to m. D (input/output) REAL or COMPLEX array, shape (:) with size(D) = p. On entry, The vectors d. On exit, the contents of D are destroyed. X (output) REAL or COMPLEX array, shape (:) with size(X) = n. The solution vector x. INFO Optional (output) INTEGER. = 0: successful exit. < 0: if INFO = -i, the i-th argument had an illegal value. If INFO is not present and an error occurs, then the program is terminated with an error message.