# djacobi

Computes the Jacobi matrix of the user's objective function using the cenral difference.

## Syntax

Fortran:

res = djacobi(fcn, n, m, fjac, x, jac_eps)

C:

res = djacobi(fcn, &n, &m, fjac, x, &jac_eps);

## Description

The routine computes the Jacobi matrix for function fcn using the central difference. This routine has "Black-Box" interface, where the user inputs the objective function via parameters. Note that in this case the user’s objective function must have a fixed interface.

## Input Parameters

fcn

  User-supplied subroutine to evaluate the function that defines the least squares problem. Call fcn (m, n, x, f) with the following parameters:

  m - INTEGER. Input parameter. Length of f

  n - INTEGER. Input parameter. Length of x.

  x - DOUBLE PRECISION. Input parameter. Array of size n. Vector, at which the function is evaluated. The fcn function should not change this parameter.

  f - DOUBLE PRECISION. Output parameter. Array of size m; contains the function values at x.

  Declare fcn as EXTERNAL in the calling program.

n

  INTEGER. Length of X.

m

  INTEGER. Length of F.

x

  DOUBLE PRECISION. Array of size n. Vector at which the function is evaluated.

eps

  DOUBLE PRECISION. Precision of the Jacobi matrix calculation.

## Output Parameters

a

  DOUBLE PRECISION. Array of size (m,n). Contains the Jacobi matrix of the function.

res

  INTEGER. Informs about the task completion.

  res = TR_SUCCESS indicates that the routine has completed the task normally.

  res = TR_INVALID_OPTION indicates an error in the input parameters.

  res = TR_OUT_OF_MEMORY indicates a memory error.

Parent topic: Jacobi Matrix Calculation Routines