rbmatlab  1.13.10
 All Classes Namespaces Files Functions Variables Groups Pages
test_rb_basisgen.m
Go to the documentation of this file.
1 function OK = test_rb_basisgen
2 %function OK = test_rb_basisgen
3 % test showing a simple greedy basis generation
4 %
5 % function generating a basis as stored in
6 % demo_lin_evol_detailed_data.mat by performing a greedy basis extension
7 % on a very small 2x2x2 parameter grid without parameter sampling adaptation.
8 %
9 % OK == 1 if test is OK, otherwise 0
10 
11 % Bernard Haasdonk 20.8.2007
12 
13 OK = 1;
14 
15 descr = convdiff_descr;
16 descr.RB_Nmax = 20;
17 descr.RB_train_num_intervals = 1;
18 descr.RB_val_size = 0;
19 descr.RB_refinement_mode = 'none';
20 [dmodel, rbmodel] = gen_models(descr);
21 
22 model_data = gen_model_data(dmodel);
23 
24 try
25  % only generate 20 basis functions, otherwise too long.
26  evalc('detailed_data = gen_detailed_data(rbmodel, model_data);');
27 catch exception
28  OK = 0;
29  disp('Execution of greedy algorithm failed with error:');
30  disp(getReport(exception));
31 end
32 
33 if get_rb_size(detailed_data.datatree) > 20
34  disp('RB basis is too large!')
35  OK = 0;
36 end;
37 
38 max_err_sequence = get_field(detailed_data.datatree, 'max_err_sequence');
39 
40 if max_err_sequence(20) > 1.2370e-04 * 1.1;
41  disp('error(20) is too large !')
42  OK = 0;
43 end;
44 
45 if max_err_sequence(20) < 1.2370e-04 * 0.1;
46  disp('error(20) is too small !')
47  OK = 0;
48 end;