6 kernel_parameters = [1];
9 'gaussian', {@(x,y,p) exp(-norm(x-y)^2/p(1)^2), [1]} ...
15 function data = gen_detailed_data(
this, model, model_data, detailed_data)
16 % Store some additional data
for the online calculation
17 reduced_data = eval([model.problem_type(),
'.ReducedData(model, detailed_data);']);
19 % TODO: Think about the training set strategy
20 mus = detailed_data.info.M_train.sample(detailed_data.info.chosen_mu, :);
23 times = zeros(nmus, 1);
24 values = zeros(nmus, 1);
26 % Perform all the expensive calculations of gamma in the
27 % offline step and store the results in the detailed_data.gamma
29 display([
'Calculating ', num2str(nmus),
' gamma values'])
31 tmpModel = copy(model);
32 tmpModel.enable_error_estimator = false;
33 tmpModel.calc_residual = false;
37 tmpModel.set_mu(mus(j, :));
39 rbsim = rb_simulation(tmpModel, reduced_data);
40 rbrec = rb_reconstruction(tmpModel, detailed_data, rbsim);
41 values(j) = tmpModel.gamma(model_data, rbrec);
42 times(j) = toc(timer);
50 function fun = gen_reduced_data(this, model, detailed_data, reduced_data)
51 % Build all components for the assembly of the
52 data = detailed_data.gamma;
53 ntrain = length(data.values);
56 f = this.kernels.(this.kernel);
57 p = this.kernel_parameters;
62 K(i,j) = f(mus(i,:), mus(j,:), p);
66 weights = K\data.values(1:ntrain);
69 function g = tmpFunction(model, reduced_data, sim)
73 g = g + f(mu, mus(k,:), p)*weights(k);
78 function gamma = calculate(model, model_data, sim)
79 error('gamma calculation through kernel is not available!')
BASE Basis class for the preparation and calculation of gamma Any subclass should also overwrite the...
Implementation of the parametric algebraic Riccati equation.
function percent = parfor_progress(N)
PARFOR_PROGRESS Progress monitor (progress bar) that works with parfor. PARFOR_PROGRESS works by crea...