NAG Library Routine Document
E04PCF solves a linear least squares problem with bounds on the variables.
|SUBROUTINE E04PCF (
||ITYPE, M, N, A, LDA, B, BL, BU, TOL, X, RNORM, NFREE, W, INDX, IFAIL)
||ITYPE, M, N, LDA, NFREE, INDX(N), IFAIL
||A(LDA,*), B(M), BL(N), BU(N), TOL, X(N), RNORM, W(N)
Given an by matrix , and an -vector, , E04PCF computes an -vector, , that solves the least-squares problem subject to satisfying .
A facility is provided to return a ‘regularized’ solution, which will closely approximate a minimal length solution whenever is not of full rank.
Lawson C L and Hanson R J (1974) Solving Least-squares Problems Prentice–Hall
- 1: ITYPE – INTEGERInput
- Specifies that a regularized solution will be computed.
- Specifies that no regularization is to take place.
- 2: M – INTEGERInput
On entry: , the number of equations.
- 3: N – INTEGERInput
On entry: , the number of variables.
- 4: A(LDA,) – REAL (KIND=nag_wp) arrayInput/Output
the second dimension of the array A
must be at least
On entry: the by matrix .
contains the product matrix,
orthogonal matrix generated by E04PCF; otherwise A
- 5: LDA – INTEGERInput
: the first dimension of the array A
as declared in the (sub)program from which E04PCF is called.
- 6: B(M) – REAL (KIND=nag_wp) arrayInput/Output
On entry: the right-hand side vector .
, the product of
times the original vector
; otherwise B
- 7: BL(N) – REAL (KIND=nag_wp) arrayInput
- 8: BU(N) – REAL (KIND=nag_wp) arrayInput
On entry: and must specify the lower and upper bounds, and respectively to be imposed on the solution vector .
, for .
- 9: TOL – REAL (KIND=nag_wp)Input
specifies a parameter used to determine the relative linear dependence of a column vector for a variable moved from its initial value. It determines the computational rank of the matrix.
If on entry , then machine precision is used.
- 10: X(N) – REAL (KIND=nag_wp) arrayOutput
On exit: the solution vector .
- 11: RNORM – REAL (KIND=nag_wp)Output
On exit: the Euclidean norm of the residual vector, .
- 12: NFREE – INTEGEROutput
On exit: indicates the number of components of the solution vector that are not at one of the constraints.
- 13: W(N) – REAL (KIND=nag_wp) arrayOutput
: contains the dual solution vector.
A value of
equal to the special value
is indicative of the matrix
not having full rank. It is only likely to occur when
. However a matrix may have less than full rank without
being set to
. Under these circumstances the value of
, and hence
, may be unreliable. If you have any doubts set
. Otherwise values have the following meaning:
- If is unconstrained.
- If is constrained by its lower bound.
- If is constrained by its upper bound.
- May be any value if .
- 14: INDX(N) – INTEGER arrayOutput
: the contents of this array describe the components of the solution vector as follows:
- , for
- These elements have not hit a constraint i.e., .
- , for
- These elements have been constrained by either the lower or upper bound constraint.
- , for
- These elements are fixed by the bounds i.e., .
is determined from NFREE
and the number of fixed components. (Often the latter will be
- 15: IFAIL – INTEGERInput/Output
must be set to
. If you are unfamiliar with this parameter you should refer to Section 3.3
in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, because for this routine the values of the output parameters may be useful even if
on exit, the recommended value is
. When the value is used it is essential to test the value of IFAIL on exit.
unless the routine detects an error or a warning has been flagged (see Section 6
6 Error Indicators and Warnings
If on entry
, explanatory error messages are output on the current error message unit (as defined by X04AAF
Note: E04PCF may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the routine:
On entry, and .
On entry, and .
Constraint: and .
On entry, when , and .
Failed to converge in iterations.
Dynamic memory allocation failed.
Orthogonal rotations are used.
If either M
is zero on entry then E04PCF sets
and simply returns without setting any other output variables.
The example minimizes
9.1 Program Text
Program Text (e04pcfe.f90)
9.2 Program Data
Program Data (e04pcfe.d)
9.3 Program Results
Program Results (e04pcfe.r)