After the
handle has been initialized (e.g.,
handle_init has been called),
handle_set_nlnls 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.
handle_set_nlnls 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
handle_set_nlnls. If
handle_set_nlnls 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 (no CPP interface) and
e04tbf (no CPP interface), respectively.
See
Section 3.1 in the
E04 Chapter Introduction for more details about the NAG optimization modelling suite.
None.
All errors and warnings have an associated numeric error code field,
errorid, stored either as a member of the thrown exception object (see
errorid), or as a member of
opt.
ifail, depending on how errors
and warnings are being handled (see
Error Handling for more details).
Not applicable.
Please see the description for the underlying computational routine in this section of the
FL Interface documentation.
Examples of the use of this method may be found in the examples for:
handle_solve_dfls_rcomm.