/usr/share/octave/packages/3.2/optim-1.0.17/optimset_compat.m is in octave-optim 1.0.17-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | ## Copyright (C) 2002 Etienne Grossmann. All rights reserved.
##
## This program is free software; you can redistribute it and/or modify it
## under the terms of the GNU General Public License as published by the
## Free Software Foundation; either version 2, or (at your option) any
## later version.
##
## This is distributed in the hope that it will be useful, but WITHOUT
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
## for more details.
## opt = optimset_compat (...) - manipulate m*tlab-style options structure
##
## This function returns a m*tlab-style options structure that can be used
## with the fminunc() function.
##
## INPUT : Input consist in one or more structs followed by option-value
## pairs. The option that can be passed are those of m*tlab's 'optimset'.
## Whether fminunc() accepts them is another question (see fminunc()).
##
## Two extra options are supported which indicate how to use directly octave
## optimization tools (such as minimize() and other backends):
##
## "MinEquiv", [on|off] : Tell 'fminunc()' not to minimize 'fun', but
## instead return the option passed to minimize().
##
## "Backend", [on|off] : Tell 'fminunc()' not to minimize 'fun', but
## instead return the [backend, opt], the name of the
## backend optimization function that is used and the
## optional arguments that will be passed to it. See
## the 'backend' option of minimize().
##
function opt = optimset_compat (varargin)
## Diagnostics , ["on"|{"off"}] :
## DiffMaxChange, [scalar>0] : N/A (I don't know what it does)
## DiffMinChange, [scalar>0] : N/A (I don't know what it does)
## Display , ["off","iter","notify","final"]
## : N/A
args = varargin;
opt = struct ();
# Integrate all leading structs
while length (args) && isstruct (o = args{1})
args = args(2:length(args)); # Remove 1st element of args
# Add key/value pairs
for [v,k] = o, opt = setfield (opt,k,v); end
end
## All the option
op1 = [" DerivativeCheck Diagnostics DiffMaxChange DiffMinChange",\
" Display GoalsExactAchieve GradConstr GradObj Hessian HessMult",\
" HessPattern HessUpdate Jacobian JacobMult JacobPattern",\
" LargeScale LevenbergMarquardt LineSearchType MaxFunEvals MaxIter",\
" MaxPCGIter MeritFunction MinAbsMax PrecondBandWidth TolCon",\
" TolFun TolPCG TolX TypicalX ",\
" MinEquiv Backend "];
opt = read_options (args, "op1",op1, "default",opt,"prefix",1,"nocase",1);
|