rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
riccati_rb_gamma.m
Go to the documentation of this file.
1 function gamma = riccati_rb_gamma(model, reduced_data, sim_data)
2 %[gamma] = riccati_rb_gamma(model, reduced_data, sim_data)
3 %
4 % Calculate the norm of the inverse Lyapunov operator for the RB
5 % approximation. This can be done in several ways, depending on the field
6 % reduced_data.estim.gamma.mode which is directly copied from
7 % model.RB_gamma_mode.
8 %
9 % interpol: use an interpolation based calculation of the constant
10 % kernel_interpolation: kernel interpolation based approximation
11 % exponential_bound: use an exponential bound to calculate the constant
12 %
13 % Andreas Schmidt, 2015
14 if ~isfield(reduced_data.estim, 'gamma')
15  gamma = 1;
16  return
17 end
18 
19 if strcmp(reduced_data.estim.gamma.mode, 'interpol')
20  gamma = reduced_data.estim.gamma.interpolant(get_mu(model)');
21 elseif strcmp(reduced_data.estim.gamma.mode, 'kernel_interpolation')
22  % Get the kernel weights and the kernel
23  alpha = reduced_data.estim.gamma.alpha;
24  k = riccati_kernel_functions(model, reduced_data.estim.gamma.kernel);
25  mus = reduced_data.estim.gamma.interpol_mus;
26 
27  gamma = 0;
28  mu = get_mu(model);
29 
30  for j = 1:length(alpha)
31  gamma = gamma + alpha(j)*k(mu(:)', mus(j,:));
32  end
33 elseif strcmp(reduced_data.estim.gamma.mode, 'exponential_bound')
34  % TODO: Make me fast!!!
35  model_data = gen_model_data(model);
36  [E,A,B,~] = riccati_assemble_system_matrices(model, model_data);
37 
38  nu = eigs((A+A'), E, 1, 'sm')/2;
39  n = normest(E\(B*B'*reduced_data.RB*sim_data.PN*reduced_data.RB'*E));
40 
41  gamma = -reduced_data.estim.normEInv^2/2/(nu+n);
42 else
43  gamma = -1;
44  warning('The gamma approximation mode is not known')
45 end
46 
47 end
function gamma = riccati_rb_gamma(model, reduced_data, sim_data)
[gamma] = riccati_rb_gamma(model, reduced_data, sim_data)
function [ E , A , B , C , x0 ] = riccati_assemble_system_matrices(model, model_data)
model_data)