The routine may be called by the names e04pcf or nagf_opt_bnd_lin_lsq.
Given an matrix , an -vector of lower bounds, an -vector of upper bounds, 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. A minimal length solution is the solution to the problem which has the smallest Euclidean norm.
The algorithm works by applying orthogonal transformations to the matrix and to the right-hand side to obtain within the matrix an upper triangular matrix . In general the elements of corresponding to the columns of will be the candidate nonzero solutions. If a diagonal element of is small compared to the other members of then this is undesirable. will be nearly singular and the equations for thus ill-conditioned. You may specify the tolerance used to determine the relative linear dependence of a column vector for a variable moved from its initial value.
Lawson C L and Hanson R J (1974) Solving Least Squares Problems Prentice–Hall
1: – IntegerInput
On entry: provides the choice of returning a regularized solution if the matrix is not of full rank.
Specifies that a regularized solution is to be computed.
Specifies that no regularization is to take place.
unless there is a definite need for a minimal length solution we recommend that is used.
2: – IntegerInput
On entry: , the number of linear equations.
3: – IntegerInput
On entry: , the number of variables.
4: – Real (Kind=nag_wp) arrayInput/Output
Note: the second dimension of the array a
must be at least
On entry: the matrix .
On exit: if , a contains the product matrix , where is an orthogonal matrix generated by e04pcf; otherwise, a is unchanged.
5: – IntegerInput
On entry: the first dimension of the array a as declared in the (sub)program from which e04pcf is called.
6: – Real (Kind=nag_wp) arrayInput/Output
On entry: the right-hand side vector .
On exit: if , the product of times the original vector , where is as described in argument a; otherwise, b is unchanged.
7: – Real (Kind=nag_wp) arrayInput
8: – 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: – Real (Kind=nag_wp)Input
On entry: tol 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. Increasing its value from will increase the likelihood of additional elements of being set to zero. It may be worth experimenting with increasing values of tol to determine whether the nature of the solution, , changes significantly. In practice a value of is recommended (see x02ajf).
If on entry , is used.
10: – Real (Kind=nag_wp) arrayOutput
On exit: the solution vector .
11: – Real (Kind=nag_wp)Output
On exit: the Euclidean norm of the residual vector .
12: – IntegerOutput
On exit: indicates the number of components of the solution vector that are not at one of the constraints.
13: – Real (Kind=nag_wp) arrayOutput
On exit: contains the dual solution vector. The magnitude of gives a measure of the improvement in the objective value if the corresponding bound were to be relaxed so that could take different values.
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 . If , then the values contained in w (other than those set to ) may be unreliable; the corresponding values in indx may likewise be unreliable. If you have any doubts set . Otherwise, the values of 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: – Integer arrayOutput
On exit: the contents of this array describe the components of the solution vector as follows:
These elements of the solution have not hit a constraint; i.e., .
These elements of the solution have been constrained by either the lower or upper bound.
These elements of the solution are fixed by the bounds; i.e., .
Here is determined from nfree and the number of fixed components. (Often the latter will be , so will be .)
15: – IntegerInput/Output
On entry: ifail must be set to , or to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value or is recommended. If message printing is undesirable, then the value is recommended. Otherwise, the value is recommended since useful values can be provided in some output arguments even when on exit. When the value or is used it is essential to test the value of ifail on exit.
On exit: unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
Note: in some cases e04pcf may return useful information.
On entry, .
On entry, and .
On entry, .
On entry, when , and .
The routine failed to converge in iterations. This is not expected. Please contact NAG.
An unexpected error has been triggered by this routine. Please
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
Orthogonal rotations are used.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
e04pcf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
If either m or n is zero on entry then e04pcf sets and simply returns without setting any other output arguments.