1 function reduced_data = lin_ds_gen_reduced_data(model,detailed_data)
2 %
function reduced_data = lin_ds_gen_reduced_data(model,detailed_data)
4 %
function computing reduced data
for rb ds simulation
6 % Bernard Haasdonk 2.4.2009
8 %model.affine_decomp_mode =
'components';
12 Wtrans = detailed_data.W
';
13 Vtrans = detailed_data.V';
17 % reduced system matrices:
19 x0comp = detailed_data.x0_components;
20 Q_x0 = length(x0comp);
23 x0r{i} = Wtrans * x0comp{i};
26 %Acomp = model.A_function_ptr(model);
27 Acomp = detailed_data.A_components;
31 Ar{i} = Wtrans * Acomp{i} * detailed_data.V;
34 %Bcomp = model.B_function_ptr(model);
35 Bcomp = detailed_data.B_components;
39 Br{i} = Wtrans * Bcomp{i};
42 %Ccomp = model.C_function_ptr(model);
43 Ccomp = detailed_data.C_components;
47 Cr{i} = Ccomp{i}*detailed_data.V;
50 if model.enable_error_estimator
52 % error estimator matrices:
56 M1{q1,q2} = Vtrans*(Acomp{q1}
')*detailed_data.G*Acomp{q2}*detailed_data.V;
63 M2{q1,q2} = (Bcomp{q1}')*detailed_data.G*Bcomp{q2};
68 M3 = Vtrans * detailed_data.G * detailed_data.V;
73 M4{q1,q2} = (Bcomp{q1}
')*detailed_data.G*Acomp{q2}*detailed_data.V;
79 M5{q} = Vtrans * detailed_data.G * Acomp{q}*detailed_data.V;
84 M6{q} = Vtrans * detailed_data.G * Bcomp{q};
88 %I_minVW = speye(size(detailed_data.V,1))- detailed_data.V*Wtrans;
89 %Mtemp = I_minVW' * detailed_data.G * I_minVW;
92 % m{q1,q2} = x0comp{q1}
'*Mtemp*x0comp{q2};
96 % instead of large dense matrix allocation equivalent:
98 % a
' G b - (a' W) (V
' G b) - (a' G V) (W
' b) + (a' W) (V
' G V) (W' b)
100 % these components can not be summed up here,
101 % as we must be able to extract online data
for other reduced dimensions!!!
102 % hence no longer computation of m here
103 % but decomposition as follows:
105 % m00: 2d cell array of values x0{q}
'G x0{q'}
106 % VtGx0: 1d cell array of of vectors (V
' G x0{q})
107 % Wtx0: 1d cell array of of vectors (W' x0{q})
108 % VtGV : matrix V
' G V
110 % then in rb_simulation the above sum can be easily performed
114 m00 = cell(Q_x0,Q_x0);
115 VtGx0 = cell(1,Q_x0);
121 % m{q1,q2} = x0comp{q1}'*Mtemp*x0comp{q2};
122 % m{q1,q2} = v1t * G * v2 - (v1t * W) * (Vtrans * G * v2) ...
123 % - (v1t * G * V) * (Wtrans * v2) ...
124 % + (v1t * W) * (Vtrans * G * V) * (Wtrans * v2);
125 m00{q1,q2}= v1
'*G*v2;
127 VtGx0{q1} = Vtrans * G * v1;
128 Wtx0{q1} = Wtrans * v1;
130 VtGV = Vtrans * G * V;
133 reduced_data.x0r = x0r;
134 reduced_data.Ar = Ar;
135 reduced_data.Br = Br;
136 reduced_data.Cr = Cr;
137 reduced_data.N = size(V,2);
139 if model.enable_error_estimator
140 reduced_data.M1 = M1;
141 reduced_data.M2 = M2;
142 reduced_data.M3 = M3;
143 reduced_data.M4 = M4;
144 reduced_data.M5 = M5;
145 reduced_data.M6 = M6;
147 reduced_data.m00 = m00; %: 2d cell array of values x0{q}'G x0{q
'}
148 reduced_data.VtGx0 = VtGx0; %: 1d cell array of of vectors (V' G x0{q})
149 reduced_data.Wtx0 = Wtx0; %: 1d cell array of of vectors (W
' x0{q})
150 reduced_data.VtGV = VtGV; %: matrix V' G V