After the
handle has been initialized (e.g.,
e04rac has been called),
e04rmc may be used to declare the objective function of the optimization problem as a sum of squares. 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
$x$ is an
$n$dimensional variable vector and
${r}_{j}\left(x\right)$ are nonlinear residuals (see
Section 2.2.3 in the
E04 Chapter Introduction). The values of the residuals, and possibly their derivatives, will be communicated to the solver by a usersupplied 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
${m}_{r}=0$,
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.
 NE_ALLOC_FAIL

Dynamic memory allocation failed.
See
Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
 NE_BAD_PARAM

On entry, argument $\u27e8\mathit{\text{value}}\u27e9$ had an illegal value.
 NE_HANDLE

The supplied
handle does not define a valid handle to the data structure for the NAG optimization modelling suite. It has not been properly initialized or it has been corrupted.
 NE_INT

On entry, ${\mathbf{isparse}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{isparse}}=0$ or $1$.
On entry, ${\mathbf{nnzrd}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{nnzrd}}>0$.
On entry, ${\mathbf{nres}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: ${\mathbf{nres}}\ge 0$.
 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 contact
NAG for assistance.
See
Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
 NE_INVALID_CS

On entry, $i=\u27e8\mathit{\text{value}}\u27e9$, ${\mathbf{icolrd}}\left[\mathit{i}1\right]=\u27e8\mathit{\text{value}}\u27e9$ and ${\mathbf{nres}}=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: $1\le {\mathbf{icolrd}}\left[\mathit{i}1\right]\le {\mathbf{nres}}$.
On entry, $i=\u27e8\mathit{\text{value}}\u27e9$, ${\mathbf{irowrd}}\left[\mathit{i}1\right]=\u27e8\mathit{\text{value}}\u27e9$ and $n=\u27e8\mathit{\text{value}}\u27e9$.
Constraint: $1\le {\mathbf{irowrd}}\left[\mathit{i}1\right]\le n$.
On entry, more than one element of first derivative matrix has row index $\u27e8\mathit{\text{value}}\u27e9$ and column index $\u27e8\mathit{\text{value}}\u27e9$.
Constraint: each element of first derivative matrix must have a unique row and column index.
 NE_NO_LICENCE

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.
 NE_PHASE

The problem cannot be modified right now, the solver is running.
Not applicable.
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
$n=2$,
${m}_{r}=3$ and the residuals are computed by:
The expected result is:
with an objective value of
$0.015$.
See also the examples in Section 10 in
e04ffc and
e04kfc.
None.