|
NAG[e02gcc] NAG[nag_linf_fit] - -approximation by general linear function
|
|
Calling Sequence
e02gcc(a, b, relerr, x, resmax, rank, iter, 'm'=m, 'n'=n, 'tol'=tol, 'fail'=fail)
nag_linf_fit(. . .)
Parameters
|
a - Matrix(1.. , 1.. , datatype=float[8], order=order);
|
|
|
Note: this array may be supplied in Fortran_order or C_order , as specified by order. All array parameters must use a consistent order.
|
|
Note: the dimension, dim, of the array a must be at least .
|
|
On exit: contains the last simplex tableau.
|
|
|
b - Vector(1..m, datatype=float[8]);
|
|
|
|
relerr - assignable;
|
|
|
Note: On exit the variable relerr will have a value of type float.
|
|
On entry: must be set to a bound on the relative error acceptable in the maximum residual at the solution.
|
|
On exit: is altered as described above.
|
|
|
x - Vector(1..n, datatype=float[8]);
|
|
|
|
resmax - assignable;
|
|
|
Note: On exit the variable resmax will have a value of type float.
|
|
On exit: if an optimal but not necessarily unique solution is found, resmax contains the absolute value of the largest residual(s) for the solution vector . (See b.)
|
|
|
rank - assignable;
|
|
|
Note: On exit the variable rank will have a value of type integer.
|
|
On exit: if an optimal but not necessarily unique solution is found, rank contains the computed rank of the matrix .
|
|
|
iter - assignable;
|
|
|
Note: On exit the variable iter will have a value of type integer.
|
|
On exit: if an optimal but not necessarily unique solution is found, iter contains the number of iterations taken by the simplex method.
|
|
|
'm'=m - integer; (optional)
|
|
|
On entry: the number of equations, (the number of rows of the matrix ).
|
|
Constraint: . .
|
|
|
'n'=n - integer; (optional)
|
|
|
On entry: the number of unknowns, (the number of columns of the matrix ).
|
|
Constraint: . .
|
|
|
'tol'=tol - float; (optional)
|
|
|
Suggested value: . (default: )
|
|
|
'fail'=fail - table; (optional)
|
|
|
The NAG error argument, see the documentation for NagError.
|
|
|
|
Description
|
|
|
Purpose
|
|
nag_linf_fit (e02gcc) calculates an solution to an over-determined system of linear equations.
|
|
Description
|
|
Given a matrix with rows and columns and a vector with elements, the function calculates an solution to the over-determined system of equations
That is to say, it calculates a vector , with elements, which minimizes the norm of the residuals (the absolutely largest residual)
where the residuals are given by
Here is the element in row and column of , is the th element of and the th element of . The matrix need not be of full rank. The solution is not unique in this case, and may not be unique even if is of full rank.
Alternatively, in applications where a complete minimization of the norm is not necessary, you may obtain an approximate solution, usually in shorter time, by giving an appropriate value to the argument relerr.
Typically in applications to data fitting, data consisting of points with co-ordinates is to be approximated in the norm by a linear combination of known functions ,
This is equivalent to finding an solution to the over-determined system of equations
Thus if, for each value of and the element of the matrix above is set equal to the value of and is set equal to , the solution vector will contain the required values of the . Note that the independent variable above can, instead, be a vector of several independent variables (this includes the case where each is a function of a different variable, or set of variables).
The algorithm is a modification of the simplex method of linear programming applied to the dual formation of the problem (see Barrodale and Phillips (1974) and Barrodale and Phillips (1975)). The modifications are designed to improve the efficiency and stability of the simplex method for this particular application.
|
|
Error Indicators and Warnings
|
|
"NE_ALLOC_FAIL"
Dynamic memory allocation failed.
"NE_BAD_PARAM"
On entry, argument had an illegal value.
"NE_INT"
On entry, . Constraint: .
"NE_INT_2"
On entry, , . Constraint: .
"NE_INTERNAL_ERROR"
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please consult NAG for assistance.
"NE_NON_UNIQUE"
An optimal solution has been obtained, but may not be unique.
"NE_TERMINATION_FAILURE"
Premature termination due to rounding errors. Try using larger value of tol: .
|
|
Accuracy
|
|
Experience suggests that the computational accuracy of the solution is comparable with the accuracy that could be obtained by applying Gaussian elimination with partial pivoting to the equations which have residuals of largest absolute value. The accuracy therefore varies with the conditioning of the problem, but has been found generally very satisfactory in practice.
|
|
|
Examples
|
|
>
|
m := 5:
n := 3:
tol := 0.0:
relerr := 0.0:
a := Matrix([[1, 1.22140275816017, 1.49182469764127, 1.822118800390509, 2.225540928492468, 0], [1, 0.8187307530779818, 0.6703200460356393, 0.5488116360940264, 0.4493289641172216, 0], [1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]], datatype=float[8]):
b := Vector([4.501, 4.36, 4.333, 4.418, 4.625], datatype=float[8]):
x := Vector(3, datatype=float[8]):
NAG:-e02gcc(a, b, relerr, x, resmax, rank, iter, 'm' = m, 'n' = n, 'tol' = tol):
|

|
|
See Also
|
|
Barrodale I and Phillips C (1974) An improved algorithm for discrete Chebyshev linear approximation Proc. 4th Manitoba Conf. Numerical Mathematics 177–190 University of Manitoba, Canada
Barrodale I and Phillips C (1975) Solution of an overdetermined system of linear equations in the Chebyshev norm [F4] (Algorithm 495) ACM Trans. Math. Software 1 (3) 264–270
e02 Chapter Introduction.
NAG Toolbox Overview.
NAG Web Site.
|
|