After the
handle has been initialized (e.g.,
e04rac has been called),
e04rmc 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.
e04rmc 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
e04rmc. If
e04rmc 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
e04tcc and
e04tbc, respectively.
See
Section 4.1 in the
E04 Chapter Introduction for more details about the
NAG optimization modelling suite.
None.
Not applicable.
Background information to multithreading can be found in the
Multithreading documentation.
Internal changes have been made to this function 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
e04rmc and solve it with
e04ffc 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
e04ffc and
e04kfc.
None.