LCLSQ

Solves a linear least-squares problem with linear constraints.

Required Arguments

A — Matrix of dimension NRA by NCA containing the coefficients of the NRA least squares equations. (Input)

B — Vector of length NRA containing the right-hand sides of the least squares equations. (Input)

C — Matrix of dimension NCON by NCA containing the coefficients of the NCON constraints. (Input)
If NCON = 0, C is not referenced.

BL — Vector of length NCON containing the lower limit of the general constraints. (Input)
If there is no lower limit on the I-th constraint, then BL(I) will not be referenced.

BU — Vector of length NCON containing the upper limit of the general constraints. (Input)
If there is no upper limit on the I-th constraint, then BU(I) will not be referenced. If there is no range constraint, BL and BU can share the same storage locations.

IRTYPE — Vector of length NCON indicating the type of constraints exclusive of simple bounds, where IRTYPE(I) = 0, 1, 2, 3 indicates .EQ., .LE., .GE., and range constraints respectively. (Input)

XLB — Vector of length NCA containing the lower bound on the variables. (Input)
If there is no lower bound on the I-th variable, then XLB(I) should be set to 1.0E30.

XUB — Vector of length NCA containing the upper bound on the variables. (Input)
If there is no upper bound on the I-th variable, then XUB(I) should be set to -1.0E30.

X — Vector of length NCA containing the approximate solution. (Output)

Optional Arguments

NRA — Number of least-squares equations. (Input)
Default: NRA = size (A,1).

NCA — Number of variables. (Input)
Default: NCA = size (A,2).

NCON — Number of constraints. (Input)
Default: NCON = size (C,1).

LDA — Leading dimension of A exactly as specified in the dimension statement of the calling program. (Input)
LDA must be at least NRA.
Default: LDA = size (A,1).

LDC — Leading dimension of C exactly as specified in the dimension statement of the calling program. (Input)
LDC must be at least NCON.
Default: LDC = size (C,1).

RES — Vector of length NRA containing the residuals B  AX of the least-squares equations at the approximate solution. (Output)

FORTRAN 90 Interface

Generic: CALL LCLSQ (A, B, C, BL, BU, IRTYPE, XLB, XUB, X [])

Specific: The specific interface names are S_LCLSQ and D_LCLSQ.

FORTRAN 77 Interface

Single: CALL LCLSQ (NRA, NCA, NCON, A, LDA, B, C, LDC, BL, BU, IRTYPE, XLB, XUB, X, RES)

Double: The double precision name is DLCLSQ.

Description

The routine LCLSQ solves linear least-squares problems with linear constraints. These are systems of least-squares equations of the form Ax  b, subject to

bl Cx bu

xl x xu

Here, A is the coefficient matrix of the least-squares equations, b is the right-hand side, and C is the coefficient matrix of the constraints. The vectors blbuxl and xu are the lower and upper bounds on the constraints and the variables, respectively. The system is solved by defining dependent variables y  Cx and then solving the least squares system with the lower and upper bounds on x and y. The equation Cx  y = 0 is a set of equality constraints. These constraints are realized by heavy weighting, i.e. a penalty method, Hanson, (1986, pages 826834).

Comments

1. Workspace may be explicitly provided, if desired, by use of L2LSQ/DL2LSQ. The reference is:

CALL L2LSQ (NRA, NCA, NCON, A, LDA, B, C, LDC, BL, BU, IRTYPE, XLB, XUB, X, RES, WK, IWK)

The additional arguments are as follows:

WK — Real work vector of length (NCON + MAXDIM* (NCA + NCON + 1) + 10 * NCA + 9 * NCON + 3.

IWK — Integer work vector of length 3 * (NCON + NCA).

2. Informational errors

 

Type

Code

Description

3

1

The rank determination tolerance is less than machine precision.

4

2

The bounds on the variables are inconsistent.

4

3

The constraint bounds are inconsistent.

4

4

Maximum number of iterations exceeded.

3. Integer Options with Chapter 11 Options Manager

13 Debug output flag. If more detailed output is desired, set this option to the value 1. Otherwise, set it to 0. Default value is 0.

14 Maximum number of add/drop iterations. If the value of this option is zero, up to 5 * max(nra, nca) iterations will be allowed. Otherwise set this option to the desired iteration limit. Default value is 0.

4. Floating Point Options with Chapter 11 Options Manager

2 The value of this option is the relative rank determination tolerance to be used. Default value is sqrt(AMACH (4)).

5 The value of this option is the absolute rank determination tolerance to be used. Default value is sqrt(AMACH (4)).

Example

A linear least-squares problem with linear constraints is solved.

 

USE LCLSQ_INT

USE UMACH_INT

USE SNRM2_INT

!

! Solve the following in the least squares sense:

! 3x1 + 2x2 + x3 = 3.3

! 4x1 + 2x2 + x3 = 2.3

! 2x1 + 2x2 + x3 = 1.3

! x1 + x2 + x3 = 1.0

!

! Subject to: x1 + x2 + x3 <= 1

! 0 <= x1 <= .5

! 0 <= x2 <= .5

! 0 <= x3 <= .5

!

! ----------------------------------------------------------------------

! Declaration of variables

!

INTEGER NRA, NCA, MCON, LDA, LDC

PARAMETER (NRA=4, NCA=3, MCON=1, LDC=MCON, LDA=NRA)

!

INTEGER IRTYPE(MCON), NOUT

REAL A(LDA,NCA), B(NRA), BC(MCON), C(LDC,NCA), RES(NRA), &

RESNRM, XSOL(NCA), XLB(NCA), XUB(NCA)

! Data initialization!

DATA A/3.0E0, 4.0E0, 2.0E0, 1.0E0, 2.0E0, &

2.0E0, 2.0E0, 1.0E0, 1.0E0, 1.0E0, 1.0E0, 1.0E0/, &

B/3.3E0, 2.3E0, 1.3E0, 1.0E0/, &

C/3*1.0E0/, &

BC/1.0E0/, IRTYPE/1/, XLB/3*0.0E0/, XUB/3*.5E0/

!

! Solve the bounded, constrained

! least squares problem.

!

CALL LCLSQ (A, B, C, BC, BC, IRTYPE, XLB, XUB, XSOL, RES=res)

! Compute the 2-norm of the residuals.

RESNRM = SNRM2 (NRA, RES, 1)

! Print results

CALL UMACH (2, NOUT)

WRITE (NOUT, 999) XSOL, RES, RESNRM

!

999 FORMAT (’ The solution is ’, 3F9.4, //, ’ The residuals ’, &

’evaluated at the solution are ’, /, 18X, 4F9.4, //, &

’ The norm of the residual vector is ’, F8.4)

!

END

Output

The solution is 0.5000 0.3000 0.2000

The residuals evaluated at the solution are

-1.0000 0.5000 0.5000 0.0000

 

The norm of the residual vector is 1.2247