You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -328,34 +328,54 @@ See Zhou, Doyle, Glover (1996) for similar (somewhat less symmetric) formulas.
328
328
329
329
α = pos_feedback ?1:-1# The sign of feedback
330
330
331
-
s1_B1 = sys1.B[:,W1]
332
-
s1_B2 = sys1.B[:,U1]
333
-
s1_C1 = sys1.C[Z1,:]
334
-
s1_C2 = sys1.C[Y1,:]
331
+
@viewsbegin
332
+
s1_B2 = U1 isa Colon ? sys1.B : sys1.B[:,U1]
333
+
s1_C2 = Y1 isa Colon ? sys1.C : sys1.C[Y1,:]
334
+
s1_D12 = Z1 isa Colon && U1 isa Colon ? sys1.D : sys1.D[Z1,U1]
335
+
s1_D21 = Y1 isa Colon && W1 isa Colon ? sys1.D : sys1.D[Y1,W1]
336
+
s1_D22 = Y1 isa Colon && U1 isa Colon ? sys1.D : sys1.D[Y1,U1]
337
+
338
+
s2_B2 = sys2.B[:,U2]
339
+
s2_C2 = sys2.C[Y2,:]
340
+
s2_D22 = sys2.D[Y2,U2]
341
+
end
342
+
# These are deliberate copies instead of views for two reasons.
343
+
# 1) Many of them are overwritten in-place below
344
+
# 2) Some that are not overwritten are still copied since it greatly reduces compile time. These are the ones that are by default indexed by an empty array (W2/Z2), implying that the copy will be an empty array as well.
335
345
s1_D11 = sys1.D[Z1,W1]
336
-
s1_D12 = sys1.D[Z1,U1]
337
-
s1_D21 = sys1.D[Y1,W1]
338
-
s1_D22 = sys1.D[Y1,U1]
339
-
346
+
s1_C1 = sys1.C[Z1,:]
347
+
s1_B1 = sys1.B[:,W1]
340
348
s2_B1 = sys2.B[:,W2]
341
-
s2_B2 = sys2.B[:,U2]
342
349
s2_C1 = sys2.C[Z2,:]
343
-
s2_C2 = sys2.C[Y2,:]
344
350
s2_D11 = sys2.D[Z2,W2]
345
-
s2_D12 = sys2.D[Z2,U2]
346
351
s2_D21 = sys2.D[Y2,W2]
347
-
s2_D22 = sys2.D[Y2,U2]
352
+
s2_D12 = sys2.D[Z2,U2]
353
+
354
+
αs2_D12 = α*s2_D12
355
+
s2_D22s1_C2 = s2_D22*s1_C2
356
+
αs2_B2 = α*s2_B2
357
+
s1_D22s2_C2 = s1_D22*s2_C2
358
+
s1_D22s2_D21 = s1_D22*s2_D21
348
359
349
360
ifiszero(s1_D22) ||iszero(s2_D22)
350
-
A = [sys1.A + α*s1_B2*s2_D22*s1_C2 α*s1_B2*s2_C2;
351
-
s2_B2*s1_C2 sys2.A + α*s2_B2*s1_D22*s2_C2]
352
-
353
-
B = [s1_B1 + α*s1_B2*s2_D22*s1_D21 α*s1_B2*s2_D21;
354
-
s2_B2*s1_D21 s2_B1 + α*s2_B2*s1_D22*s2_D21]
355
-
C = [s1_C1 + α*s1_D12*s2_D22*s1_C2 α*s1_D12*s2_C2;
356
-
s2_D12*s1_C2 s2_C1 + α*s2_D12*s1_D22*s2_C2]
357
-
D = [s1_D11 + α*s1_D12*s2_D22*s1_D21 α*s1_D12*s2_D21;
0 commit comments