rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
error_indicator.m
1 % Calculate the errors for the basis stored in the matrix RB
2 function [errs, avg_time, errs_abs, errs_true] = error_indicator(model, model_data, RB_W, RB_V, training_mus)
3  errs = zeros(size(training_mus,1),1);
4  errs_abs = zeros(size(training_mus,1),1);
5 
6  dd = ARE.detailed_data;
7  dd.RB_V = RB_V;
8  dd.RB_W = RB_W;
9 
10  rd = model.reduce(model_data, dd);
11  t = tic;
12  parfor i = 1:size(training_mus,1)
13  tmpModel = model;
14  tmpModel.set_mu(training_mus(i, :));
15  tmpModel.RB_error_estimation = false;
16  tmpModel.RB_calc_residual = true;
17  try
18  rsim = rb_simulation(tmpModel, rd);
19  errs(i) = rsim.nresidual;
20  errs_abs(i) = rsim.residual;
21  catch e
22  training_mus(i,:)
23  warning(['Solution not calculable: ', e.message])
24  errs(i) = -Inf;
25  end
26  end
27 
28  avg_time = toc(t);
29 end
Implementation of the parametric algebraic Riccati equation.