After the
handle has been initialized (e.g.,
e04raf has been called),
e04rmf may be used to define the residual functions in the objective function of nonlinear least squares or general nonlinear data fitting problems. If the objective function has already been defined, it will be overwritten. It will typically be used in data fitting or calibration problems of the form
where
is an
-dimensional variable vector,
are nonlinear residuals (see
Section 2.2.3 in the
E04 Chapter Introduction), and
is a type of loss function. For example, the model of a least squares problem can be written as
The values of the residuals, and possibly their derivatives, will be communicated to the solver by a user-supplied function.
e04rmf also allows the structured first derivative matrix
to be declared as being dense or sparse. If declared as sparse, its sparsity structure must be specified by
e04rmf. If
e04rmf is called with
,
any existing objective function is removed, no new one is added and the problem will be solved as a feasible point problem.
Note that it is possible to temporarily disable and enable individual residuals in the model by
e04tcf and
e04tbf, respectively.
See
Section 3.1 in the
E04 Chapter Introduction for more details about the NAG optimization modelling suite.
None.
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
Not applicable.
Background information to multithreading can be found in the
Multithreading documentation.
Internal changes have been made to this routine as follows:
- At Mark 27.1: Previously, it was not possible to modify the objective function once it was set or to edit the model once a solver had been called. These limitations have been removed and the associated error codes were removed.
For details of all known issues which have been reported for the NAG Library please refer to the
Known Issues.
In this example, we demonstrate how to declare a least squares problem through
e04rmf and solve it with
e04fff on a very simple example. Here
,
and the residuals are computed by:
The expected result is:
with an objective value of
.
See also the examples in Section 10 in
e04fff and
e04kff.
None.