After the initialization function
e04rac has been called and unless the objective function has already been defined,
e04rmc may be used to declare the objective function of the optimization problem as a sum of squares. It will typically be used in data fitting or calibration problems of the form
where
$x$ is an
$n$dimensional variable vector and
${r}_{i}\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 here.
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_ALREADY_DEFINED

The objective function has already been defined.
 NE_BAD_PARAM

On entry, argument $\u2329\mathit{\text{value}}\u232a$ 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 initialized by
e04rac or it has been corrupted.
 NE_INT

On entry, ${\mathbf{isparse}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: ${\mathbf{isparse}}=0$ or $1$.
On entry, ${\mathbf{nnzrd}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: ${\mathbf{nnzrd}}>0$.
On entry, ${\mathbf{nres}}=\u2329\mathit{\text{value}}\u232a$.
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=\u2329\mathit{\text{value}}\u232a$, ${\mathbf{icolrd}}\left[\mathit{i}1\right]=\u2329\mathit{\text{value}}\u232a$ and ${\mathbf{nres}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: $1\le {\mathbf{icolrd}}\left[\mathit{i}1\right]\le {\mathbf{nres}}$.
On entry, $i=\u2329\mathit{\text{value}}\u232a$, ${\mathbf{irowrd}}\left[\mathit{i}1\right]=\u2329\mathit{\text{value}}\u232a$ and $n=\u2329\mathit{\text{value}}\u232a$.
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 $\u2329\mathit{\text{value}}\u232a$ and column index $\u2329\mathit{\text{value}}\u232a$.
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 Hessians of nonlinear functions have already been defined, a nonlinear objective cannot be added.
The problem cannot be modified in this phase any more, the solver has already been called.
Not applicable.
None.
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$.
None.