24 % REDUCEDDATA Constructor
for the
class
25 model_data = detailed_data.model_data;
27 % Extract the reduced basis matrices
28 V = detailed_data.RB_V;
29 W = detailed_data.RB_W;
33 obj.RB_size = size(W,2);
35 for k = 1:length(model_data.A_comp)
36 obj.A_comp{k} = W
'*model_data.A_comp{k}*V;
39 for k = 1:length(model_data.B_comp)
40 obj.B_comp{k} = W'*model_data.B_comp{k};
43 for k = 1:length(model_data.C_comp)
44 obj.C_comp{k} = model_data.C_comp{k}*V;
47 for k = 1:length(model_data.E_comp)
48 obj.E_comp{k} = W
'*model_data.E_comp{k}*V;
51 obj.R_comp = model_data.R_comp;
52 obj.Q_comp = model_data.Q_comp;
54 % Calculate all the reduced quantities:
56 for i = 1:length(model_data.C_comp)
57 for j = 1:length(model_data.A_comp)
58 estim.M1a{i,j} = model_data.C_comp{i}*model_data.A_comp{j}'*W;
61 for i = 1:length(model_data.E_comp)
62 for j = 1:length(model_data.C_comp)
63 estim.M1b{i,j} = W
'*model_data.E_comp{i}*model_data.C_comp{j}';
68 for i=1:length(model_data.C_comp)
69 for j=1:length(model_data.C_comp)
70 for k=1:length(model_data.E_comp)
71 for l=1:length(model_data.E_comp)
72 estim.M4{i,j,k,l} = (W
'*model_data.E_comp{k}*model_data.C_comp{i}')*(model_data.C_comp{j}*model_data.E_comp{l}
'*W);
80 for i = 1:length(model_data.A_comp)
81 for j = 1:length(model_data.E_comp)
82 estim.M3{i,j} = W'*model_data.E_comp{j}*(model_data.A_comp{i})
'*W;
83 estim.M6{i,j} = estim.M3{i,j}';
85 for j = 1:length(model_data.A_comp)
86 estim.M5{i,j} = W
'*model_data.A_comp{i}*(model_data.A_comp{j}')*W;
90 for i = 1:length(model_data.C_comp)
91 for j = 1:length(model_data.C_comp)
92 estim.M7{i,j} = model_data.C_comp{i}*model_data.C_comp{j}
';
96 for i = 1:length(model_data.E_comp)
97 for j = 1:length(model_data.E_comp)
98 estim.M8{i,j} = W'*model_data.E_comp{i}*(model_data.E_comp{j}
')*W;
104 if length(model_data.E_comp) > 1
105 error('We cannot deal with more than one component in the matrices E,B,R,Q
')
108 % Finally the last components for the error estimator:
109 [~,nE] = evalc('svds(model_data.E_comp{1}, 1);
');
113 [~,nEinv] = evalc('1/svds(model_data.E_comp{1},1,0);
');
115 estim.normEinv = nEinv;
117 % Prepare the value for ||BR^{-1}B^T||
119 estim.normBBT_use2norm = false;
120 if length(model_data.B_comp) == 1
121 estim.normBBT = norm(full(model_data.B_comp{1}));
122 estim.normBBT_use2norm = true;
124 % We use the Frobenius norm as an upper bound for the
126 for i = 1:length(model_data.B_comp)
127 for j = 1:length(model_data.B_comp)
128 for k = 1:length(model_data.B_comp)
129 for l = 1:length(model_data.B_comp)
130 estim.normBBT{i,j,k,l} = trace(model_data.B_comp{k}'*model_data.B_comp{l});
139 % For the calculation of norm A:
141 for i = 1:length(model_data.A_comp)
142 for j = 1:length(model_data.A_comp)
143 normA{i,j} = trace(model_data.A_comp{i}'*model_data.A_comp{j});
149 for i = 1:length(model_data.B_comp)
150 for j = 1:length(model_data.B_comp)
151 normB{i,j} = trace(model_data.B_comp{i}
'*model_data.B_comp{j});
157 if ~isempty(detailed_data.gamma)
158 obj.gamma_function = detailed_data.gamma_calculation.gen_reduced_data(model, detailed_data, obj);
160 obj.gamma_mode = detailed_data.gamma_mode;
Abstract OOP model implementation interface.