2 detailed_data,reduced_data,...
7 %
function determining the test-error-indicators
for the given set of
8 % vectors mu (columns in M_test) of the RB simulation with corresponding
9 % RB set. Either the
true errors or the error-estimators are
10 % determined. If the
true errors are wanted, these are produced
11 % into or read from the directory savepath. The offline_data is
12 % generated,
if empty. The detailed data can be ommited
if
13 % offline_data is available, and no
true 'error' is wanted
15 % Required fields of model:
16 % RB_error_indicator:
'error' or
'estimator'
17 % error_algorithm : in
case of
'error' mode,
this algorithm
18 % is called
for computing the error between a U and Uappr
20 % Bernard Haasdonk 27.5.2007
22 if isempty(reduced_data)
23 reduced_data = gen_reduced_data(model,detailed_data);
26 if ~isfield(model,'N')
27 if isfield(detailed_data,'N')
28 model.N=detailed_data.N;
30 model.N = size(model.get_rb_from_detailed_data(detailed_data),2);
33 if isfield(model,'rb_problem_type')
34 if isequal(model.rb_problem_type,'nonlin_evol') ...
35 || isequal(model.rb_problem_type, 'richards')
36 if ~isfield(model,'M') || (model.M==-1)
37 model.M = max(cellfun(@(X)(size(X,2)), detailed_data.QM));
43 reduced_data = model.reduced_data_subset(model, reduced_data);
46 switch model.RB_error_indicator
48 test_err = rb_test_error(model,...
49 detailed_data, reduced_data, M_test, ...
51 case 'projection-error'
52 test_err = rb_test_projection_error(model,...
53 detailed_data, reduced_data, M_test, ...
57 test_err = rb_test_estimator(model,...
60 case 'estimator_parallel'
61 test_err = rb_test_estimator_parallel(model,...
65 case 'ei_estimator_test'
67 test_err.estimator = rb_test_estimator(model, ...
71 test_err.error = rb_test_error(model, ...
72 detailed_data, reduced_data, M_test, ...
75 lambda = test_err.estimator ./ test_err.error;
76 disp(['Evaluation of the reliability lambda=Delta_est/Delta_err of a ',...
77 'posteriori estimator (min, max, mean):']);
78 disp(['min(lambda)=',num2str(min(lambda)), ...
79 ' max(lambda)=',num2str(max(lambda)), ...
80 ' mean(lambda)=', num2str(mean(lambda))]);
81 disp('Evaluation of the runtime gain of posteriori estimator');
82 disp(['t_post=',num2str(t1),' t_err=',num2str(t2)]);
83 if(any(test_err.estimator < test_err.error))
84 disp('Error: a posteriori estimator underestimates the real error');
88 error('error indicator type unknown');
function test_err = rb_test_indicator(model, detailed_data, reduced_data, M_test, savepath)
M_test,[savepath])