Mercurial > octave
comparison scripts/optimization/fminunc.m @ 30893:e1788b1a315f
maint: Use "fcn" as preferred abbreviation for "function" in m-files.
* accumarray.m, accumdim.m, quadl.m, quadv.m, randi.m, structfun.m,
__is_function__.m, uigetfile.m, uimenu.m, uiputfile.m, doc_cache_create.m,
colorspace_conversion_input_check.m, imageIO.m, argnames.m, vectorize.m,
vectorize.m, normest1.m, inputname.m, nthargout.m, display_info_file.m,
decic.m, ode15i.m, ode15s.m, ode23.m, ode23s.m, ode45.m, odeset.m,
check_default_input.m, integrate_adaptive.m, ode_event_handler.m,
runge_kutta_23.m, runge_kutta_23s.m, runge_kutta_45_dorpri.m,
runge_kutta_interpolate.m, starting_stepsize.m, __all_opts__.m, fminbnd.m,
fminsearch.m, fminunc.m, fsolve.m, fzero.m, sqp.m, fplot.m, plotyy.m,
__bar__.m, __ezplot__.m, flat_entry.html, profexport.m, movfun.m, bicg.m,
bicgstab.m, cgs.m, eigs.m, gmres.m, pcg.m, __alltohandles__.m, __sprand__.m,
qmr.m, tfqmr.m, dump_demos.m:
Replace "func", "fun", "fn" in documentation and variable names with "fcn".
author | Rik <rik@octave.org> |
---|---|
date | Mon, 04 Apr 2022 18:14:56 -0700 |
parents | 5d3faba0342e |
children | 597f3ee61a48 |
comparison
equal
deleted
inserted
replaced
30892:1a3cc2811090 | 30893:e1788b1a315f |
---|---|
35 ## @var{fcn}. | 35 ## @var{fcn}. |
36 ## | 36 ## |
37 ## @code{fminunc} attempts to determine a vector @var{x} such that | 37 ## @code{fminunc} attempts to determine a vector @var{x} such that |
38 ## @code{@var{fcn} (@var{x})} is a local minimum. | 38 ## @code{@var{fcn} (@var{x})} is a local minimum. |
39 ## | 39 ## |
40 ## @var{fun} is a function handle, inline function, or string containing the | 40 ## @var{fcn} is a function handle, inline function, or string containing the |
41 ## name of the function to evaluate. @var{fcn} should accept a vector (array) | 41 ## name of the function to evaluate. @var{fcn} should accept a vector (array) |
42 ## defining the unknown variables, and return the objective function value, | 42 ## defining the unknown variables, and return the objective function value, |
43 ## optionally with gradient. | 43 ## optionally with gradient. |
44 ## | 44 ## |
45 ## @var{x0} determines a starting guess. The shape of @var{x0} is preserved in | 45 ## @var{x0} determines a starting guess. The shape of @var{x0} is preserved in |
411 endif | 411 endif |
412 | 412 |
413 endfunction | 413 endfunction |
414 | 414 |
415 ## A helper function that evaluates a function and checks for bad results. | 415 ## A helper function that evaluates a function and checks for bad results. |
416 function [fx, gx] = guarded_eval (fun, x) | 416 function [fx, gx] = guarded_eval (fcn, x) |
417 | 417 |
418 if (nargout > 1) | 418 if (nargout > 1) |
419 [fx, gx] = fun (x); | 419 [fx, gx] = fcn (x); |
420 else | 420 else |
421 fx = fun (x); | 421 fx = fcn (x); |
422 gx = []; | 422 gx = []; |
423 endif | 423 endif |
424 | 424 |
425 if (! (isreal (fx) && isreal (gx))) | 425 if (! (isreal (fx) && isreal (gx))) |
426 error ("Octave:fminunc:notreal", "fminunc: non-real value encountered"); | 426 error ("Octave:fminunc:notreal", "fminunc: non-real value encountered"); |