usrfun must define the problem functions Fx. This method is passed to e04vj as the external parameter usrfun.

Syntax

C#
public delegate void E04VJ_USRFUN(
	ref int status,
	int n,
	double[] x,
	int needf,
	int nf,
	double[] f,
	int needg,
	double[] g
)
Visual Basic
Public Delegate Sub E04VJ_USRFUN ( _
	ByRef status As Integer, _
	n As Integer, _
	x As Double(), _
	needf As Integer, _
	nf As Integer, _
	f As Double(), _
	needg As Integer, _
	g As Double() _
)
Visual C++
public delegate void E04VJ_USRFUN(
	int% status, 
	int n, 
	array<double>^ x, 
	int needf, 
	int nf, 
	array<double>^ f, 
	int needg, 
	array<double>^ g
)
F#
type E04VJ_USRFUN = 
    delegate of 
        status : int byref * 
        n : int * 
        x : float[] * 
        needf : int * 
        nf : int * 
        f : float[] * 
        needg : int * 
        g : float[] -> unit

Parameters

status
Type: System..::..Int32%
On entry: indicates the first call to usrfun.
status=0
There is nothing special about the current call to usrfun.
status=1
e04vj is calling your method for the first time. Some data may need to be input or computed and saved.
On exit: may be used to indicate that you are unable to evaluate F at the current x. (For example, the problem functions may not be defined there).
e04vj evaluates Fx at random perturbation of the initial point x, say xp. If the functions cannot be evaluated at xp, you can set status=-1, e04vj will use another random perturbation.
If for some reason you wish to terminate the current problem, set status-2.
n
Type: System..::..Int32
On entry: n, the number of variables, as defined in the call to e04vj.
x
Type: array<System..::..Double>[]()[][]
On entry: the variables x at which the problem functions are to be calculated. The array x must not be altered.
needf
Type: System..::..Int32
On entry: indicates if f must be assigned during the call to usrfun (see f).
nf
Type: System..::..Int32
On entry: nf, the number of problem functions.
f
Type: array<System..::..Double>[]()[][]
On entry: this will be set by e04vj.
On exit: the computed Fx according to the setting of needf.
If needf=0, f is not required and is ignored.
If needf>0, the components of Fx must be calculated and assigned to f. e04vj will always call usrfun with needf>0.
To simplify the code, you may ignore the value of needf and compute Fx on every entry to usrfun.
needg
Type: System..::..Int32
On entry: e04vj will call usrfun with needg=0 to indicate that g is not required.
g
Type: array<System..::..Double>[]()[][]
On entry: concerns the calculations of the derivatives of the function fx.
On exit: e04vj will always call usrfun with needg=0: g is not required to be set on exit but must be declared correctly.

See Also