-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathscges_opt.m
executable file
·53 lines (49 loc) · 1.31 KB
/
scges_opt.m
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
function opt = scges_opt(opt)
%SCGES_OPT Default options for scaled conjugate gradient optimization
%
% Description
% OPT=SCGES_OPT returns default options for SCGES
% OPT=SCGES_OPT(OPT); fills empty options with default values
%
% The options and defaults are
% display (0)
% 0 to not display anything
% 1 to display just diagnostic messages
% 2 positive integer to show also the function values and
% validation values every iteration
% checkgrad (0)
% 1 to check the user defined gradient function
% maxiter (1000)
% maximum number of iterations
% tolfun (1e-6)
% termination tolerance on the function value
% tolx (1e-6)
% termination tolerance on X
%
% See also
% SCGES
% Copyright (c) Aki Vehtari (1998-2010)
% This software is distributed under the GNU General Public
% License (version 3 or later); please refer to the file
% License.txt, included with the software, for details.
if nargin < 1
opt=[];
end
if ~isfield(opt,'display')
opt.display=0;
end
if ~isfield(opt,'checkgrad')
opt.checkgrad=0;
end
if ~isfield(opt,'maxiter') | opt.maxiter < 1
opt.maxiter=100;
end
if ~isfield(opt,'tolfun') | opt.tolfun < 0
opt.tolfun=1e-6;
end
if ~isfield(opt,'tolx') | opt.tolx < 0
opt.tolx=1e-6;
end
if ~isfield(opt,'maxfail')
opt.maxfail=20;
end