# dtrnlspbc_solve

Solves a nonlinear least squares problem with linear (bound) constraints using theTrust-Region algorithm.

## Syntax

Fortran:

res = dtrnlspbc_solve(handle, fvec, fjac, RCI_Request)

C:

res = dtrnlspbc_solve(&handle, fvec, fjac, &RCI_Request);

## Description

The dtrnlspbc_solve routine, based on Reverse Communication Interface (RCI), uses the Trust-Region algorithm to solve nonlinear least squares problems with linear (bound) constraints. The problem is stated as follows:

where m ≥ n, `F : Rn → Rm` and `fi(x)` is the i-th component function of F(x).

The RCI_Request parameter informs about the task completion and may have the following values:

RCI_Request= 2 that indicates the requirement to calculate the Jacobian matrix and put the result into fjac.

RCI_Request= 1 that indicates the requirement to recalculate the function at vector X and put the result into fvec.

RCI_Request= 0 that indicates successful completion of the task

RCI_Request= -1 indicating that the algorithm has exceeded the maximal number of iterations.

RCI_Request= -2 indicating that `Δk < eps(1)`

RCI_Request= -3 indicating that `||F(x)|| < eps(2)`

RCI_Request= -4 indicating that `||A(x)ij|| < eps(3)`

RCI_Request= -5 indicating that `||s|| < eps(4)`

RCI_Request= -6 indicating that `||F(x)||- ||F(x) - A(x)s|| < eps(5)`,

where A is the Jacobi matrix, `Δk` is the trust region area, `F(x)` is the value of the functional, `s` is the trial step.

## Input Parameters

handle

  Data object of the _TRNSPBC_HANDLE_t type in C/C++ and INTEGER*8 in FORTRAN.

fvec

  DOUBLE PRECISION. Array of size m. Contains the function values at X, where `fvec(i) = (yi – fi(x))`.

fjac

  DOUBLE PRECISION. Array of size m by n. Contains the Jacobi matrix of the function.

## Output Parameters

fvec

  DOUBLE PRECISION. Array of size m. Contains the updated function values at X

RCI_Request

  INTEGER. Informs about the task completion. When equal to 0, the task is completed succefully.

  See Description for the other values of the parameter and their meaning.

res

  INTEGER. Informs about the task completion.

  res = TR_SUCCESS means the routine completed the task normally.

Parent topic: Nonlinear Least Squares Problem with Linear (Bound) Constraints