The function may be called by the names: e04pcc or nag_opt_bnd_lin_lsq.
Given an matrix , an -vector of lower bounds, an -vector of upper bounds, and an -vector , e04pcc 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: – Nag_RegularizedTypeInput
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: – doubleInput/Output
Note: the th element of the matrix is stored in .
On entry: the matrix .
On exit: if , a contains the product matrix , where is an orthogonal matrix generated by e04pcc; otherwise, a is unchanged.
5: – IntegerInput
On entry: the stride separating matrix row elements in the array a.
6: – doubleInput/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: – const doubleInput
8: – const doubleInput
On entry: and must specify the lower and upper bounds, and respectively, to be imposed on the solution vector .
, for .
9: – doubleInput
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 X02AJC).
If on entry , is used.
10: – doubleOutput
On exit: the solution vector .
11: – double *Output
On exit: the Euclidean norm of the residual vector .
12: – Integer *Output
On exit: indicates the number of components of the solution vector that are not at one of the constraints.
13: – doubleOutput
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: – IntegerOutput
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: – NagError *Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).
6Error Indicators and Warnings
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument had an illegal value.
The function failed to converge in iterations. This is not expected. Please contact NAG.
On entry, .
On entry, .
On entry, and .
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL 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 CL Interface for further information.
On entry, when , and .
Orthogonal rotations are used.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
e04pcc 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 function. 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 e04pcc sets NE_NOERROR and simply returns without setting any other output arguments.