rbmatlab  1.13.10
 All Classes Namespaces Files Functions Variables Groups Pages
newton_time_comparison.m
1 csample = 0.4:0.2:1;
2 
3 Ms = [];
4 Ns = [];
5 
6 crbtimes = [];
7 rbtimes = [];
8 sizes = [];
9 maxerrs = [];
10 
11 for c=1:length(csample)
12  newdir = fullfile(rbmatlabtemp, ['time_run_fixed', num2str(c)])
13  mkdir(newdir);
14  outfile = newton_steps(0);
15  load(outfile);
16  model.Mmax = ceil(csample(c)*model.MMax);
17  model.RB_stop_Nmax = ceil(csample(c)*model.RB_stop_Nmax);
18  Ms = [Ms, model.Mmax]; Ns = [Ns, model.RB_stop_Nmax];
19  save(outfile, 'model', 'model_data');
20 
21  newton_steps(2);
22  outfile = newton_steps(5);
23  tmp = load(outfile);
24  crbtimes = [crbtimes, tmp.detailed_data.ei_info{1}.elapsed_time]
25  rbtimes = [rbtimes, tmp.detailed_data.RB_info.elapsed_time]
26  sizes = [sizes, [size(tmp.detailed_data.RB,2);...
27  size(tmp.detailed_data.QM{1},2)] ];
28  copyfile(outfile, fullfile(newdir, 'detailed'));
29  clear 'tmp';
30  outfile = newton_steps(7);
31  copyfile(outfile, fullfile(newdir, 'errs'));
32  tmp = load(outfile);
33  maxerrs = [maxerrs, tmp.output{1}.errs(1)];
34 end
35 
36 for c=1:length(csample)
37  newdir = fullfile(rbmatlabtemp, ['time_run_adapted', num2str(c)])
38  mkdir(newdir);
39  outfile = newton_steps(0);
40  load(outfile);
41  model.Mmax = ceil(csample(c)*model.MMax);
42  model.RB_stop_Nmax = ceil(csample(c)*model.RB_stop_Nmax);
43  Ms = [Ms, model.Mmax]; Ns = [Ns, model.RB_stop_Nmax];
44 
45  model.RB_generation_mode = 'greedy_refined';
46  model.RB_numintervals = ones(size(model.RB_numintervals));
47  save(outfile, 'model', 'model_data');
48 
49  newton_steps(2);
50  outfile = newton_steps(5);
51  tmp = load(outfile);
52  crbtimes = [crbtimes, tmp.detailed_data.ei_info{1}.elapsed_time]
53  rbtimes = [rbtimes, tmp.detailed_data.RB_info.elapsed_time]
54  sizes = [sizes, [size(tmp.detailed_data.RB,2);...
55  size(tmp.detailed_data.QM{1},2)] ];
56  copyfile(outfile, fullfile(newdir, 'detailed'));
57  clear 'tmp';
58  outfile = newton_steps(7);
59  copyfile(outfile, fullfile(newdir, 'errs'));
60  tmp = load(outfile);
61  maxerrs = [maxerrs, tmp.output{1}.errs(1)];
62 end
63