<< uncprb_getclass Unconstrained Optimization Problems Toolbox uncprb_getgrdfcn >>

Unconstrained Optimization Problems Toolbox >> Unconstrained Optimization Problems Toolbox > uncprb_getfunc

uncprb_getfunc

Returns the function vector, the Jacobian and, if available, the Hessian.

Calling Sequence

fvec=uncprb_getfunc(n,m,x,nprob,option)
[fvec,J]=uncprb_getfunc(n,m,x,nprob,option)
[fvec,J,H]=uncprb_getfunc(n,m,x,nprob,option)

Parameters

n:

the number of variables, i.e. the size of x

m:

the number of functions, i.e. the size of fvec

x:

a n x 1 matrix of doubles, the point where to compute f

nprob:

the problem number

option:

option=1 set fvec only (J=[]), option=2 set J only (fvec=[]), option= 3 set fvec and J, option= 4 set fvec, J and H

fvec:

a m x 1 matrix of doubles, the vector (f1(x), f2(x), ... fm(x))^T

J:

a m x n matrix of doubles, the Jacobian matrix, dfi(x)/dxj, i=1,..,m , j=1, ..., n

H:

a n x n matrix of doubles, the Hessian matrix, d^2f(x)/dxi/dxj, i,j=1,..,n

Description

Selects the appropriate test function based on nprob.

Examples

// Get fvec and J at x0 for Rosenbrock's test case
nprob = 1
[n,m,x0]=uncprb_getinitf(nprob)
option = 3
[fvec,J]=uncprb_getfunc(n,m,x0,nprob,option)

// See what happens if option=1
option = 1
[fvec,J]=uncprb_getfunc(n,m,x0,nprob,option)

// See what happens if option=2
option = 2
[fvec,J]=uncprb_getfunc(n,m,x0,nprob,option)

// See what happens if option=4 (the Hessian is available for Rosenbrock's problem)
option = 4
[fvec,J,H]=uncprb_getfunc(n,m,x0,nprob,option)

// See the error generated if option=4 for a problem for which the Hessian is not provided:
// the Hessian is NOT available for problem #2.
nprob = 2
[n,m,x0]=uncprb_getinitf(nprob)
option = 4
[fvec,J,H]=uncprb_getfunc(n,m,x0,nprob,option)

Authors

<< uncprb_getclass Unconstrained Optimization Problems Toolbox uncprb_getgrdfcn >>