Function fdjac1

This subroutine computes a forward-difference approximation to the n by n Jacobian matrix associated with a specified problem of n functions in n variables. If the Jacobian has a banded form, then function evaluations are saved by only approximating the nonzero terms.

void fdjac1(Real, Func) (
  Func fcn,
  size_t n,
  Real* x,
  Real* fvec,
  Real* fjac,
  size_t ldfjac,
  int iflag,
  size_t ml,
  Real epsfcn,
  size_t mu,
  Real* wa1,
  Real* wa2
);

Parameters

NameDescription
fcn the name of the user-supplied function or delegate which calculates the functions. fcn should be written as follows. --- void f(size_t n, real* x, real* fvec, int iflag) { // calculate the functions at x and // return this vector in fvec. } --- The value of iflag should not be changed by fcn unless the user wants to terminate execution of fdjac1. In this case set iflag to a negative integer.
n a positive integer input variable set to the number of functions and variables.
x an input array of length n.
fvec an input array of length n which must contain the functions evaluated at x.
fjac an output n by n array which contains the approximation to the Jacobian matrix evaluated at x.
ldfjac a positive integer input variable not less than n which specifies the leading dimension of the array fjac.
iflag an integer variable which can be used to terminate the execution of fdjac1. See description of fcn.
ml a nonnegative integer input variable which specifies the number of subdiagonals within the band of the Jacobian matrix. If the Jacobian is not banded, set ml to at least n - 1.
epsfcn an input variable used in determining a suitable step length for the forward-difference approximation. This approximation assumes that the relative errors in the functions are of the order of epsfcn. If epsfcn is less than the machine precision, it is assumed that the relative errors in the functions are of the order of the machine precision.
mu a nonnegative integer input variable which specifies the number of superdiagonals within the band of the Jacobian matrix. If the jacobian is not banded, set mu to at least n - 1.
wa1 work array of length n.
wa2 work array of length n. If ml + mu + 1 is at least n, then the Jacobian is considered dense, and wa2 is not referenced.