Purpose ======= LA_GGGLM solves the general (Gauss-Markov) linear model (GLM) problem: min ||y||2 subject to d=A*x + B*y x where A and B are real or complex rectangular matrices and d is a real or complex vector. Further, A is n by m, B is n by p, and d is n by 1, and it is assumed that m <= n <= m+p, rank(A) = m, rank(A, B) = n. These conditions ensure that the GLM problem has unique solution vectors x and y. The problem is solved using the generalized QR factorization of A and B. If matrix B is square and nonsingular, then the GLM problem is equivalent to the weighted linear least squares problem min ||B^-1 * (d-A*x)||2 x ========= SUBROUTINE LA_GGGLM( A, B, D, X, Y, INFO=info ) (), INTENT( INOUT ) :: A(:,:), B(:,:), D(:) (), INTENT( OUT ) :: X(:), Y(:) 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) = n and size(A,2) = m. 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) = n and size(B,2) = p. On entry, the matrix B. On exit, the contents of B are destroyed. D (input/output) REAL or COMPLEX array, shape (:) with size(D) = n. On entry, the vector d. On exit, the contents of D are destroyed. X (output) REAL or COMPLEX array, shape (:) with size(X) = m. The solution vector x. Y (output) REAL or COMPLEX array, shape (:) with size(Y) = p. The solution vector y. 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.