F08ZAF (DGGLSE) (PDF version)
F08 Chapter Contents
F08 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

F08ZAF (DGGLSE)

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

F08ZAF (DGGLSE) solves a real linear equality-constrained least squares problem.

2  Specification

SUBROUTINE F08ZAF ( M, N, P, A, LDA, B, LDB, C, D, X, WORK, LWORK, INFO)
INTEGER  M, N, P, LDA, LDB, LWORK, INFO
REAL (KIND=nag_wp)  A(LDA,*), B(LDB,*), C(M), D(P), X(N), WORK(max(1,LWORK))
The routine may be called by its LAPACK name dgglse.

3  Description

F08ZAF (DGGLSE) solves the real linear equality-constrained least squares (LSE) problem
minimize x c-Ax2  subject to  Bx=d
where A is an m by n matrix, B is a p by n matrix, c is an m element vector and d is a p element vector. It is assumed that pnm+p, rankB=p and rankE=n, where E= A B . These conditions ensure that the LSE problem has a unique solution, which is obtained using a generalized RQ factorization of the matrices B and A.

4  References

Anderson E, Bai Z, Bischof C, Blackford S, Demmel J, Dongarra J J, Du Croz J J, Greenbaum A, Hammarling S, McKenney A and Sorensen D (1999) LAPACK Users' Guide (3rd Edition) SIAM, Philadelphia
Anderson E, Bai Z and Dongarra J (1992) Generalized QR factorization and its applications Linear Algebra Appl. (Volume 162–164) 243–271
Eldèn L (1980) Perturbation theory for the least-squares problem with linear equality constraints SIAM J. Numer. Anal. 17 338–350

5  Parameters

1:     M – INTEGERInput
On entry: m, the number of rows of the matrix A.
Constraint: M0.
2:     N – INTEGERInput
On entry: n, the number of columns of the matrices A and B.
Constraint: N0.
3:     P – INTEGERInput
On entry: p, the number of rows of the matrix B.
Constraint: 0PNM+P.
4:     A(LDA,*) – REAL (KIND=nag_wp) arrayInput/Output
Note: the second dimension of the array A must be at least max1,N.
On entry: the m by n matrix A.
On exit: A is overwritten.
5:     LDA – INTEGERInput
On entry: the first dimension of the array A as declared in the (sub)program from which F08ZAF (DGGLSE) is called.
Constraint: LDAmax1,M.
6:     B(LDB,*) – REAL (KIND=nag_wp) arrayInput/Output
Note: the second dimension of the array B must be at least max1,N.
On entry: the p by n matrix B.
On exit: B is overwritten.
7:     LDB – INTEGERInput
On entry: the first dimension of the array B as declared in the (sub)program from which F08ZAF (DGGLSE) is called.
Constraint: LDBmax1,P.
8:     C(M) – REAL (KIND=nag_wp) arrayInput/Output
On entry: the right-hand side vector c for the least squares part of the LSE problem.
On exit: the residual sum of squares for the solution vector x is given by the sum of squares of elements CN-P+1,CN-P+2,,CM; the remaining elements are overwritten.
9:     D(P) – REAL (KIND=nag_wp) arrayInput/Output
On entry: the right-hand side vector d for the equality constraints.
On exit: D is overwritten.
10:   X(N) – REAL (KIND=nag_wp) arrayOutput
On exit: the solution vector x of the LSE problem.
11:   WORK(max1,LWORK) – REAL (KIND=nag_wp) arrayWorkspace
On exit: if INFO=0, WORK1 contains the minimum value of LWORK required for optimal performance.
12:   LWORK – INTEGERInput
On entry: the dimension of the array WORK as declared in the (sub)program from which F08ZAF (DGGLSE) is called.
If LWORK=-1, 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.
Suggested value: for optimal performance, LWORKP+minM,N+maxM,N×nb, where nb is the optimal block size.
Constraint: LWORK max1,M+N+P  or LWORK=-1.
13:   INFO – INTEGEROutput
On exit: INFO=0 unless the routine detects an error (see Section 6).

6  Error Indicators and Warnings

Errors or warnings detected by the routine:
INFO<0
If INFO=-i, argument i had an illegal value. An explanatory message is output, and execution of the program is terminated.
INFO=1
The upper triangular factor R associated with B in the generalized RQ factorization of the pair B,A is singular, so that rankB<p; the least squares solution could not be computed.
INFO=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 singular, so that the rank of the matrix (E) comprising the rows of A and B is less than n; the least squares solutions could not be computed.

7  Accuracy

For an error analysis, see Anderson et al. (1992) and Eldèn (1980). See also Section 4.6 of Anderson et al. (1999).

8  Further Comments

When mn=p, the total number of floating point operations is approximately 23n26m+n; if pn, the number reduces to approximately 23n23m-n.
E04NCF/E04NCA may also be used to solve LSE problems. It differs from F08ZAF (DGGLSE) in that it uses an iterative (rather than direct) method, and that it allows general upper and lower bounds to be specified for the variables x and the linear constraints Bx.

9  Example

This example solves the least squares problem
minimize x c-Ax2   subject to   Bx=d
where
c = -1.50 -2.14 1.23 -0.54 -1.68 0.82 ,
A = -0.57 -1.28 -0.39 0.25 -1.93 1.08 -0.31 -2.14 2.30 0.24 0.40 -0.35 -1.93 0.64 -0.66 0.08 0.15 0.30 0.15 -2.13 -0.02 1.03 -1.43 0.50 ,
B = 1.0 0 -1.0 0 0 1.0 0 -1.0
and
d = 0 0 .
The constraints Bx=d  correspond to x1 = x3  and x2 = x4 .

9.1  Program Text

Program Text (f08zafe.f90)

9.2  Program Data

Program Data (f08zafe.d)

9.3  Program Results

Program Results (f08zafe.r)


F08ZAF (DGGLSE) (PDF version)
F08 Chapter Contents
F08 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012