<< uncprb_leastsqjac Benchmark uncprb_lsqrsolveget >>

Unconstrained Optimization Problems Toolbox >> Unconstrained Optimization Problems Toolbox > Benchmark > uncprb_lsqrsolvefun

uncprb_lsqrsolvefun

Returns the residual vector for the lsqrsolve function.

Calling Sequence

r = uncprb_lsqrsolvefun ( x, m, nprob, n )

Parameters

x:

a n-by-1 matrix of doubles, the point where to compute f and g

nprob:

a 1-by-1 matrix of doubles, integer value, the problem number

n:

a 1-by-1 matrix of doubles, integer value, the number of variables, i.e. the size of x

m:

a 1-by-1 matrix of doubles, integer value, the number of functions, i.e. the size of fvec

r:

a m-by-1 matrix of doubles, the residual

Description

This function is designed to be used to make the lsqrsolve solver optimize the problem #nprob. Indeed, the header of the uncprb_lsqrsolvefun function is the one required by the optim function.

Examples

// Check wrapper on problem #1
nprob = 1;
[n,m,x0]=uncprb_getinitf(nprob);
r = uncprb_lsqrsolvefun ( x0, m, nprob, n )
// r0 = [-4.4; 2.2]

// Make lsqrsolve optimize the problem #1
nprob = 1;
[n,m,x0]=uncprb_getinitf(nprob)
[xopt, ropt,info]=lsqrsolve(x0,list(uncprb_lsqrsolvefun,nprob,n),m)

// Make lsqrsolve optimize the problem #1
// Get the number of iterations, function and gradient evaluations
nprob = 1;
[n,m,x0]=uncprb_getinitf(nprob);
uncprb_lsqrsolveinit();
objfun = list(uncprb_lsqrsolvefun,nprob,n);
[xopt, ropt,info]=lsqrsolve(x0,objfun,m)
[foptE,xoptE] = uncprb_getopt(nprob,n,m)
goptE = uncprb_getgrdfcn(n,m,xoptE,nprob)
[funeval,geval] = uncprb_lsqrsolveget()

// Make lsqrsolve optimize the problem #1
// With Jacobian
// Get the number of iterations, function and gradient evaluations
nprob = 1;
[n,m,x0]=uncprb_getinitf(nprob);
uncprb_lsqrsolveinit();
objfun = list(uncprb_lsqrsolvefun,nprob,n);
objjac = list(uncprb_lsqrsolvejac,nprob,n);
[xopt, ropt,info]=lsqrsolve(x0,objfun,m,objjac)
[foptE,xoptE] = uncprb_getopt(nprob,n,m)
goptE = uncprb_getgrdfcn(n,m,xoptE,nprob)
[funeval,geval] = uncprb_lsqrsolveget()

Authors

<< uncprb_leastsqjac Benchmark uncprb_lsqrsolveget >>