-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_reducer_options.m
59 lines (51 loc) · 1.53 KB
/
build_reducer_options.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
54
55
56
57
58
59
function options = build_reducer_options(options)
%BUILD_REDUCER_OPTIONS Fills options structure with default data if some
%options are missing.
%
% See also REDUCER.
if ~isfield(options, 'verbose')
options.verbose = 0;
end
if ~isfield(options, 'auto_save')
options.auto_save = 0;
end
if options.auto_save && ~isfield(options, 'output_file')
options.output_file = ['reducer_' datestr(datetime, 30) '.mat'];
end
if ~isfield(options, 'graph_algorithm')
options.graph_algorithm = '';
end
switch options.graph_algorithm
case 'none'
options.graph_algorithm = @graph_reduce_empty;
otherwise
options.graph_algorithm = @graph_reduce;
end
if ~isfield(options, 'nodewise_algorithm')
options.nodewise_algorithm = '';
end
switch options.nodewise_algorithm
case 'none'
options.nodewise_algorithm = @nodewise_empty;
case 'dummy'
options.nodewise_algorithm = @nodewise_dummy;
case 'amd_dummy'
options.nodewise_algorithm = @nodewise_amd_dummy;
case 'amd_recursive'
options.nodewise_algorithm = @nodewise_amd_recursive;
case 'camd'
options.nodewise_algorithm = @nodewise_camd;
case 'nesdis_dummy'
options.nodewise_algorithm = @nodeelim_nesdis_dummy;
case 'nesdis_camd'
options.nodewise_algorithm = @nodeelim_nesdis_camd;
otherwise
options.nodewise_algorithm = @nodewise_camd;
end
if ~isfield(options, 'cost_function')
options.cost_function = @count_resistors;
end
if ~isfield(options, 'early_exit')
options.early_exit = 0;
end
end