classdef ModalSepCache
% Cache for additive decompositions (STABSEP, FREQSEP).

% Copyright 2023 The MathWorks, Inc.
properties
% Congruence transformations:
% 1) Reduction to ordered Schur/QZ form
% TL (A-s*E) TR = [A11-s*E11 A12-s*E12 ; 0 A22-s*E22]
% 2) Block diagonalization:
% [I L;0 I] [A11-s*E11 A12-s*E12 ; 0 A22-s*E22] [I R;0 I] =
% [A11-s*E11 0 ; 0 A22-s*E22]
% SPLIT contains the size of the A11 and A22 blocks.
Split
L
R
TL
TR
% Schur or QZ form for original model
SchurQZ
end

methods

function [TLD,TRD] = getBlockDiagTransform(this)
% Computes the cumulative block-diagonalizing transformations
% TRD = TR * [I R;0 I]
% TLD = [I L;0 I] * TL
% such that
% TRD * (A-s*E) * TRD = [A11-s*E11 0 ; 0 A22-s*E22].
n1 = this.Split(1);
n2 = this.Split(2);
n = n1+n2;
LD = eye(n); LD(1:n1,n1+1:n) = this.L;
RD = eye(n); RD(1:n1,n1+1:n) = this.R;
TLD = LD * this.TL;
TRD = this.TR * RD;
end

end
end