Navigation

Operators and Keywords

Function List:

C++ API

fminunc.m File Reference


Functions

endif if (nargin< 2||nargin > 3||!ismatrix(x0)) print_usage()
endif if (ischar(fcn)) fcn
 if (funvalchk) fcn
 if (!isempty(outfcn)) optimvalues.iter
 if (stop) info
 while (niter< maxiter &&nfev< maxfev &&!info) grad0
 if (has_grad)[fval
endif if (niter==1) hesr
 if (info) hesr

Variables

 function [x, fval, info, output, grad, hess]
 return
endif xsiz = size (x0)
 n = numel (x0)
 has_grad = strcmpi (optimget (options, "GradObj", "off"), "on")
 cdif = strcmpi (optimget (options, "FinDiffType", "central"), "central")
 maxiter = optimget (options, "MaxIter", 400)
 maxfev = optimget (options, "MaxFunEvals", Inf)
 outfcn = optimget (options, "OutputFcn")
 funvalchk = strcmpi (optimget (options, "FunValCheck", "off"), "on")
endif macheps = eps (class (x0))
 tolx = optimget (options, "TolX", sqrt (macheps))
 tolf = optimget (options, "TolFun", sqrt (macheps))
 factor = 0.1
 autodg = true
 niter = 1
 nfev = 0
 x = x0(:)
 info = 0
 fval = fcn (reshape (x, xsiz))
optimvalues funccount = nfev
optimvalues searchdirection = zeros (n, 1)
 state = 'init'
 stop = outfcn (x, optimvalues, state)
 break
endif endif nsuciter = 0
 lastratio = 0
 grad = []
else y = grad - grad0
 sBs = sumsq (w)
 Bs = hesr'*w
 sy = y'*s
 theta = 0.8 / max (1 - sy / sBs, 0.8)
 r = theta * y + (1-theta) * Bs
 hesr = cholupdate (hesr, r / sqrt (s'*r), "+")

Function Documentation

if ( info   ) 

endif if ( niter  = =1  ) 

if ( has_grad   ) 

if ( stop   ) 

if ( isemptyoutfcn  ) 

if ( funvalchk   ) 

endif if ( ischar(fcn  ) 

endif if ( nargin< 2||nargin > 3||!  ismatrixx0  ) 

while (  ) 


Variable Documentation

autodg = true

break

Bs = hesr'*w

cdif = strcmpi (optimget (options, "FinDiffType", "central"), "central")

factor = 0.1

optimvalues funccount = nfev

function[x, fval, info, output, grad, hess]

Initial value:

 fminunc (fcn, x0, options = struct ())


  if (nargin == 1 && ischar (fcn) && strcmp (fcn, 'defaults'))
    x = optimset ("MaxIter", 400, "MaxFunEvals", Inf, 
    "GradObj", "off", "TolX", 1.5e-8, "TolFun", 1.5e-8,
    "OutputFcn", [], "FunValCheck", "off",
    "FinDiffType", "central")

funvalchk = strcmpi (optimget (options, "FunValCheck", "off"), "on")

optimvalues fval = fcn (reshape (x, xsiz))

else grad = []

has_grad = strcmpi (optimget (options, "GradObj", "off"), "on")

hesr = cholupdate (hesr, r / sqrt (s'*r), "+")

info = 0

lastratio = 0

endif macheps = eps (class (x0))

maxfev = optimget (options, "MaxFunEvals", Inf)

maxiter = optimget (options, "MaxIter", 400)

n = numel (x0)

nfev = 0

niter = 1

outfcn = optimget (options, "OutputFcn")

r = theta * y + (1-theta) * Bs

return

sBs = sumsq (w)

optimvalues searchdirection = zeros (n, 1)

state = 'init'

stop = outfcn (x, optimvalues, state)

sy = y'*s

endif endwhile theta = 0.8 / max (1 - sy / sBs, 0.8)

tolf = optimget (options, "TolFun", sqrt (macheps))

tolx = optimget (options, "TolX", sqrt (macheps))

x = x0(:)

endif xsiz = size (x0)

else y = grad - grad0